tests: make version counting more determinist in applications tests (#71907)

This commit is contained in:
Benjamin Dauvergne 2022-12-01 10:55:29 +01:00
parent 02df3a7a81
commit 92cdad5f8c
1 changed files with 7 additions and 4 deletions

View File

@ -279,7 +279,8 @@ def test_create_application(app, admin_user, settings, analyze):
assert b'"version_notes": "Foo bar blah."' in resp.content
resp = app.get('/applications/manifest/test/versions/')
assert resp.text.count('1.0') == 1
versions = [e.text() for e in resp.pyquery('h3').items()]
assert versions.count('1.0') == 1
assert resp.text.count('Creating application bundle') == 1
resp = resp.click(href='/applications/manifest/test/download/%s/' % version.pk)
assert resp.content_type == 'application/x-tar'
@ -301,7 +302,8 @@ def test_create_application(app, admin_user, settings, analyze):
assert b'"version_notes": "Foo bar blahha."' in resp.content
resp = app.get('/applications/manifest/test/versions/')
assert resp.text.count('1.0') == 1
versions = [e.text() for e in resp.pyquery('h3').items()]
assert versions.count('1.0') == 1
assert resp.text.count('Creating application bundle') == 2
resp = resp.click(href='/applications/manifest/test/download/%s/' % same_version.pk)
assert resp.content_type == 'application/x-tar'
@ -852,8 +854,9 @@ def test_deploy_application(app, admin_user, settings, app_bundle, app_bundle_wi
assert version3.creation_timestamp < version4.creation_timestamp
assert version3.last_update_timestamp < version4.last_update_timestamp
resp = app.get('/applications/manifest/test/versions/')
assert resp.text.count('42.0') == 2
assert resp.text.count('43.0') == 1
versions = [e.text() for e in resp.pyquery('h3').items()]
assert versions.count('42.0') == 2
assert versions.count('43.0') == 1
assert resp.text.count('Deploying application bundle') == 4
def response_content(url, request):