tests: fix no determinism in tests when using postgresql (#23134)

This commit is contained in:
Benjamin Dauvergne 2018-04-12 16:30:03 +02:00
parent d7360895c7
commit 90d3f824d9
2 changed files with 7 additions and 4 deletions

View File

@ -150,6 +150,6 @@ def test_push_document_slashed_name(app, admin_user, john_doe):
assert models.Document.objects.count() == 1
doc = models.UserDocument.objects.first()
assert doc.filename == 'monfichier 18/06/2017.pdf'
assert doc.get_download_url() == '/1/download/monfichier%252018%252F06%252F2017.pdf'
assert doc.get_download_url() == '/%s/download/monfichier%%252018%%252F06%%252F2017.pdf' % doc.pk
login(app, user=john_doe)
app.get(doc.get_download_url(), status=200)

View File

@ -64,9 +64,10 @@ def test_get_document_oauth2(app, john_doe, oauth2_client, user_doc):
assert resp.status_code == 200
assert len(resp.forms[0]['document'].options) == 2
assert 'Baudelaire.txt' in resp.forms[0]['document'].options[1]
options = resp.forms[0]['document'].options
assert 'Baudelaire.txt' in options[1]
resp.forms[0]['document'].select('1')
resp.forms[0]['document'].select(options[1][0])
resp = resp.forms[0].submit()
assert len(OAuth2Authorize.objects.filter(user_document__user=john_doe)) == 1
auth = OAuth2Authorize.objects.filter(user_document__user=john_doe)[0]
@ -178,7 +179,9 @@ def test_idp_authentication(mocked_post, settings, app, oauth2_client, john_doe,
}
params['redirect_uri'] = 'https://example.com'
resp = app.get(url, params=params)
resp.forms[0]['document'].select('1')
options = resp.forms[0]['document'].options
assert 'Baudelaire.txt' in options[1]
resp.forms[0]['document'].select(options[1][0])
resp = resp.forms[0].submit()
auth = OAuth2Authorize.objects.filter(user_document__user=john_doe)[0]
params.pop('response_type')