Start dual running with "areas" and "names"

For the public API we actually receive a "name" instead of an ID,
which we also want to start sending from the Admin app.

Unlike IDs, which aren't really used anywhere, we want the names
to display the alerts on gov.uk/alerts.
This commit is contained in:
Ben Thorner
2021-08-25 15:53:05 +01:00
parent 8f39d476bd
commit 023a06d5fb
2 changed files with 4 additions and 1 deletions

View File

@@ -70,6 +70,9 @@ def create_broadcast():
'areas': [
area['name'] for area in broadcast_json['areas']
],
'names': [
area['name'] for area in broadcast_json['areas']
],
'simple_polygons': polygons.smooth.simplify.as_coordinate_pairs_long_lat,
},
status=BroadcastStatusType.PENDING_APPROVAL,

View File

@@ -88,7 +88,7 @@ def test_valid_post_cap_xml_broadcast_returns_201(
assert response_json['areas'] == [
'River Steeping in Wainfleet All Saints'
]
assert response_json['areas_2']['areas'] == [
assert response_json['areas_2']['names'] == [
'River Steeping in Wainfleet All Saints'
]
assert response_json['cancelled_at'] is None