diff --git a/app/models.py b/app/models.py index 4468ec452..c2e7f1062 100644 --- a/app/models.py +++ b/app/models.py @@ -2336,10 +2336,9 @@ class BroadcastMessage(db.Model): self._personalisation = encryption.encrypt(personalisation or {}) def serialize(self): - # TEMPORARY: while we repurpose "areas" areas = dict(self.areas) areas["simple_polygons"] = areas.get("simple_polygons", []) - areas["ids"] = areas.pop("areas", areas.get("ids", [])) + areas["ids"] = areas.get("ids", []) return { 'id': str(self.id), diff --git a/tests/app/broadcast_message/test_rest.py b/tests/app/broadcast_message/test_rest.py index 05cfb85bb..9e42d394b 100644 --- a/tests/app/broadcast_message/test_rest.py +++ b/tests/app/broadcast_message/test_rest.py @@ -19,13 +19,7 @@ from tests.app.db import ( ) -# TEMPORARY: while we repurpose "areas" -@pytest.mark.parametrize("area_data", [ - {"areas": ["place A", "region B"]}, - {"ids": ["place A", "region B"]}, -]) def test_get_broadcast_message( - area_data, admin_request, sample_broadcast_service ): @@ -37,7 +31,7 @@ def test_get_broadcast_message( bm = create_broadcast_message( t, areas={ - **area_data, + "ids": ["place A", "region B"], "simple_polygons": [[[50.1, 1.2], [50.12, 1.2], [50.13, 1.2]]], }, personalisation={ @@ -64,13 +58,7 @@ def test_get_broadcast_message( assert response['personalisation'] == {'thing': 'test'} -# TEMPORARY: while we repurpose "areas" -@pytest.mark.parametrize("area_data", [ - {"areas": ["place A", "region B"]}, - {"ids": ["place A", "region B"]}, -]) def test_get_broadcast_message_without_template( - area_data, admin_request, sample_broadcast_service ): @@ -78,7 +66,7 @@ def test_get_broadcast_message_without_template( service=sample_broadcast_service, content='emergency broadcast content', areas={ - **area_data, + "ids": ["place A", "region B"], "simple_polygons": [[[50.1, 1.2], [50.12, 1.2], [50.13, 1.2]]], }, ) diff --git a/tests/app/v2/broadcast/test_post_broadcast.py b/tests/app/v2/broadcast/test_post_broadcast.py index 5d5934f3d..acd43b307 100644 --- a/tests/app/v2/broadcast/test_post_broadcast.py +++ b/tests/app/v2/broadcast/test_post_broadcast.py @@ -103,12 +103,10 @@ def test_valid_post_cap_xml_broadcast_returns_201( assert response_json['personalisation'] is None assert response_json['service_id'] == str(sample_broadcast_service.id) - # TEMPORARY: while we repurpose "areas" assert len(response_json['areas']['simple_polygons']) == 1 assert len(response_json['areas']['simple_polygons'][0]) == 23 assert response_json['areas']['simple_polygons'][0][0] == [53.10562, 0.244127] assert response_json['areas']['simple_polygons'][0][-1] == [53.10562, 0.244127] - assert response_json['areas']['simple_polygons'][0][-1] == [53.10562, 0.244127] assert response_json['starts_at'] is None assert response_json['status'] == 'pending-approval'