From 92cdad5f8c8b0c45c48cd8da81fdae78dc9b3ae1 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Thu, 1 Dec 2022 10:55:29 +0100 Subject: [PATCH] tests: make version counting more determinist in applications tests (#71907) --- tests/test_application.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/test_application.py b/tests/test_application.py index 8d37a08..eeb7954 100644 --- a/tests/test_application.py +++ b/tests/test_application.py @@ -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): -- 2.37.2