simplify use of pytest form interface
This commit is contained in:
parent
d1d4c60269
commit
8525b48ecb
|
@ -64,12 +64,12 @@ def test_get_document_oauth2(app, john_doe, oauth2_client, user_doc):
|
|||
resp = app.get(url, params=params)
|
||||
|
||||
assert resp.status_code == 200
|
||||
assert len(resp.forms[0]['document'].options) == 2
|
||||
options = resp.forms[0]['document'].options
|
||||
assert len(resp.form['document'].options) == 2
|
||||
options = resp.form['document'].options
|
||||
assert u'éléphant.txt' in options[1]
|
||||
|
||||
resp.forms[0]['document'].select(options[1][0])
|
||||
resp = resp.forms[0].submit()
|
||||
resp.form['document'].select(options[1][0])
|
||||
resp = resp.form.submit()
|
||||
assert len(OAuth2Authorize.objects.filter(user_document__user=john_doe)) == 1
|
||||
auth = OAuth2Authorize.objects.filter(user_document__user=john_doe)[0]
|
||||
assert resp.status_code == 302
|
||||
|
@ -139,7 +139,7 @@ def test_put_document(app, john_doe, oauth2_client):
|
|||
assert OAuth2TempFile.objects.count() == 2
|
||||
assert UserDocument.objects.count() == 0
|
||||
|
||||
resp = resp.forms[0].submit()
|
||||
resp = resp.form.submit()
|
||||
assert resp.status_code == 302
|
||||
assert resp.location == 'https://example.com'
|
||||
|
||||
|
@ -180,10 +180,10 @@ def test_idp_authentication(mocked_post, settings, app, oauth2_client, john_doe,
|
|||
}
|
||||
params['redirect_uri'] = 'https://example.com'
|
||||
resp = app.get(url, params=params)
|
||||
options = resp.forms[0]['document'].options
|
||||
options = resp.form['document'].options
|
||||
assert u'éléphant.txt' in options[1]
|
||||
resp.forms[0]['document'].select(options[1][0])
|
||||
resp = resp.forms[0].submit()
|
||||
resp.form['document'].select(options[1][0])
|
||||
resp = resp.form.submit()
|
||||
auth = OAuth2Authorize.objects.filter(user_document__user=john_doe)[0]
|
||||
params.pop('response_type')
|
||||
params.pop('state')
|
||||
|
|
Loading…
Reference in New Issue