Project

General

Profile

Development #22948

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

Added by Benjamin Dauvergne over 1 year ago. Updated over 1 year ago.

Status:
Fermé
Priority:
Normal
Target version:
Start date:
31 Mar 2018
Due date:
% Done:

100%

Patch proposed:
Yes
Planning:
No

Description

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

0001-oauth2-add-command-oauth2-put-document-fixes-22948.patch View (9.92 KB) Benjamin Dauvergne, 03 Apr 2018 10:57 AM

0001-oauth2-add-command-oauth2-put-document-fixes-22948.patch View (9.88 KB) Benjamin Dauvergne, 03 Apr 2018 03:07 PM

Associated revisions

Revision a465f2c1 (diff)
Added by Benjamin Dauvergne over 1 year ago

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

History

#1 Updated by Benjamin Dauvergne over 1 year ago

  • Description updated (diff)

#2 Updated by Benjamin Dauvergne over 1 year ago

#3 Updated by Benjamin Dauvergne over 1 year ago

pdb.set_trace() qui traînait retiré.

#4 Updated by Josué Kouka over 1 year ago

  • Status changed from Nouveau to En cours

#5 Updated by Josué Kouka over 1 year ago

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 Updated by Benjamin Dauvergne over 1 year ago

  • Status changed from En cours to Résolu (à déployer)
  • % Done changed from 0 to 100

#7 Updated by Frédéric Péters over 1 year ago

  • Status changed from Résolu (à déployer) to Fermé

Also available in: Atom PDF