Projet

Général

Profil

Development #22948

oauth2: commande oauth2-put-document pour simplifier les tests de la fonctionnalité

Ajouté par Benjamin Dauvergne il y a presque 6 ans. Mis à jour il y a presque 6 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Version cible:
Début:
31 mars 2018
Echéance:
% réalisé:

100%

Temps estimé:
Patch proposed:
Oui
Planning:

Description

Elle permet de créer un lien de dépôt d'un document étant donné un client_id et un fichier.


Fichiers

Révisions associées

Révision a465f2c1 (diff)
Ajouté par Benjamin Dauvergne il y a presque 6 ans

oauth2: add command oauth2-put-document (fixes #22948)

Historique

#1

Mis à jour par Benjamin Dauvergne il y a presque 6 ans

  • Description mis à jour (diff)
#4

Mis à jour par Josué Kouka il y a presque 6 ans

  • Statut changé de Nouveau à En cours
#5

Mis à jour par Josué Kouka il y a presque 6 ans

Appliqué chez moi juste après #22949

from fargo.fargo.utils import cleanup

importé sans etre utilisé
path = os.path.join(os.path.dirname(__file__),  'pdf-sample.pdf')

un espace en trop
-                print 'https://localhost:8000' + make_url(uri, redirect_uri=redirect_uri)
+                self.stdout.write('https://localhost:8000' + make_url(uri, redirect_uri=redirect_uri))

self.stdout.write à la place de print
    def test_command_put_document(db, capsys, app, john_doe):
        call_command('oauth2-create-client', 'test', 'https://example.com/')
        client = OAuth2Client.objects.get()
        path = os.path.join(os.path.dirname(__file__),  'pdf-sample.pdf')
        redirect_uri = 'https://example.com/'
        r = call_command('oauth2-put-document', '--client-id=%s' % client.pk, redirect_uri, path)
        out, err = capsys.readouterr()
        assert err == ''
        url = out.strip()
        response = app.get(url).follow()
        response.form.set('username', john_doe.username)
        response.form.set('password', john_doe.username)
        response = response.form.submit().follow()
        assert 'pdf-sample.pdf' in response
        temp_file = OAuth2TempFile.objects.get()
>       assert temp_file.uuid in response
E       AssertionError: assert '873ca89c2883406e9a349884f31e26cc' in <200 OK text/html body='<!DOCTYPE...l>\n'/2465>
E        +  where '873ca89c2883406e9a349884f31e26cc' = <OAuth2TempFile: OAuth2TempFile object>.uuid

Une assertion qui échoue.

#6

Mis à jour par Benjamin Dauvergne il y a presque 6 ans

  • Statut changé de En cours à Résolu (à déployer)
  • % réalisé changé de 0 à 100
#7

Mis à jour par Frédéric Péters il y a presque 6 ans

  • Statut changé de Résolu (à déployer) à Fermé

Formats disponibles : Atom PDF