broadcast-areas: use area ids in tests

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
This commit is contained in:
Toby Lorne
2020-08-10 13:19:16 +01:00
parent 8c3a8ecd04
commit 6649d0ac70
3 changed files with 23 additions and 11 deletions

View File

@@ -661,7 +661,7 @@ def broadcast_message_json(
'personalisation': {},
'areas': [
'england', 'scotland',
'countries-E92000001', 'countries-S92000003',
],
'status': status,

View File

@@ -89,10 +89,18 @@ def test_get_names_of_areas():
def test_get_areas_accepts_lists():
areas_from_list = broadcast_area_libraries.get_areas(
['wales', 'vale-of-glamorgan', 'england', 'essex']
[
'countries-W92000004',
'counties-and-unitary-authorities-in-england-and-wales-W06000014',
'countries-E92000001',
'counties-and-unitary-authorities-in-england-and-wales-E10000012',
]
)
areas_from_args = broadcast_area_libraries.get_areas(
'wales', 'vale-of-glamorgan', 'england', 'essex',
'countries-W92000004',
'counties-and-unitary-authorities-in-england-and-wales-W06000014',
'countries-E92000001',
'counties-and-unitary-authorities-in-england-and-wales-E10000012',
)
assert areas_from_args == areas_from_list

View File

@@ -38,7 +38,7 @@ sample_uuid = sample_uuid()
403, 403,
),
(
'.remove_broadcast_area', {'broadcast_message_id': sample_uuid, 'area_slug': 'england'},
'.remove_broadcast_area', {'broadcast_message_id': sample_uuid, 'area_slug': 'countries-E92000001'},
403, 405,
),
(
@@ -237,9 +237,13 @@ def test_choose_broadcast_library_page(
'Regions of England',
])
hints = page.select('.file-list-hint-large')
for country in ('England, Northern Ireland, Scotland, Wales'):
assert country in hints
assert any([
all([
country in hint.text
for country in ('England', 'Northern Ireland', 'Scotland', 'Wales')
])
for hint in page.select('.file-list-hint-large')
])
assert page.select_one('a.file-list-filename-large.govuk-link')['href'] == url_for(
'.choose_broadcast_area',
@@ -278,14 +282,14 @@ def test_add_broadcast_area(
broadcast_message_id=fake_uuid,
library_slug='countries',
_data={
'areas': ['england', 'wales']
'areas': ['countries-E92000001', 'countries-W92000004']
}
)
mock_update_broadcast_message.assert_called_once_with(
service_id=SERVICE_ONE_ID,
broadcast_message_id=fake_uuid,
data={
'areas': ['england', 'scotland', 'wales']
'areas': ['countries-E92000001', 'countries-S92000003', 'countries-W92000004']
},
)
@@ -302,7 +306,7 @@ def test_remove_broadcast_area_page(
'.remove_broadcast_area',
service_id=SERVICE_ONE_ID,
broadcast_message_id=fake_uuid,
area_slug='england',
area_slug='countries-E92000001',
_expected_redirect=url_for(
'.preview_broadcast_areas',
service_id=SERVICE_ONE_ID,
@@ -314,7 +318,7 @@ def test_remove_broadcast_area_page(
service_id=SERVICE_ONE_ID,
broadcast_message_id=fake_uuid,
data={
'areas': ['scotland']
'areas': ['countries-S92000003']
},
)