From 8c3a8ecd041ab40498e1100f41a4c13e68643934 Mon Sep 17 00:00:00 2001 From: Toby Lorne Date: Mon, 10 Aug 2020 13:04:03 +0100 Subject: [PATCH] broadcast-areas: view test does not assert order the descriptions are liable to change esp for wards Signed-off-by: Toby Lorne --- tests/app/main/views/test_broadcast.py | 32 +++++++++++--------------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/tests/app/main/views/test_broadcast.py b/tests/app/main/views/test_broadcast.py index cf2bf145f..33e2f95d0 100644 --- a/tests/app/main/views/test_broadcast.py +++ b/tests/app/main/views/test_broadcast.py @@ -226,25 +226,21 @@ def test_choose_broadcast_library_page( service_id=SERVICE_ONE_ID, broadcast_message_id=fake_uuid, ) - assert [ - (normalize_spaces(title.text), normalize_spaces(hint.text)) - for title, hint in list(zip( - page.select('.file-list-filename-large'), page.select('.file-list-hint-large') - )) - ] == [ - ( - 'Counties and Unitary Authorities in England and Wales', - 'Barking and Dagenham, Barnet, Barnsley and 171 more…', - ), - ( - 'Countries', - 'England, Northern Ireland, Scotland and Wales', - ), - ( - 'Regions of England', - 'East Midlands, East of England, London and 6 more…', - ), + + titles = [ + normalize_spaces(title.text) + for title in page.select('.file-list-filename-large') ] + assert sorted(titles) == sorted([ + 'Counties and Unitary Authorities in England and Wales', + 'Countries', + 'Regions of England', + ]) + + hints = page.select('.file-list-hint-large') + for country in ('England, Northern Ireland, Scotland, Wales'): + assert country in hints + assert page.select_one('a.file-list-filename-large.govuk-link')['href'] == url_for( '.choose_broadcast_area', service_id=SERVICE_ONE_ID,