From 023a06d5fb4c20e6bf5a1c9e65b473cb376b2b6b Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Wed, 25 Aug 2021 15:53:05 +0100 Subject: [PATCH] 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. --- app/v2/broadcast/post_broadcast.py | 3 +++ tests/app/v2/broadcast/test_post_broadcast.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/v2/broadcast/post_broadcast.py b/app/v2/broadcast/post_broadcast.py index c5fae20a8..afebc0265 100644 --- a/app/v2/broadcast/post_broadcast.py +++ b/app/v2/broadcast/post_broadcast.py @@ -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, diff --git a/tests/app/v2/broadcast/test_post_broadcast.py b/tests/app/v2/broadcast/test_post_broadcast.py index ddbedaba0..6b3b57b05 100644 --- a/tests/app/v2/broadcast/test_post_broadcast.py +++ b/tests/app/v2/broadcast/test_post_broadcast.py @@ -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