mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 23:55:58 -05:00
Introduce "areas_2" so we can repurpose "areas"
Currently we have: - An "areas" column in the DB that stores a JSON blob. - An "areas" field inside the "areas" JSON that stores area IDs. - Each field has to be manually copied into the JSON column. We want to move to: - An "areas" column in the DB (unchanged). - An "ids" field inside the "areas" JSON (to replace "areas"). - The Admin app sending other data inside an "areas" JSON field. The API design for areas is confusing and difficult to extend. Here we duplicate the current API functionality using an "areas_2" field. Once the Admin app is using this field, we'll be able to rename it to just "areas", which is where we want to get to. In the next commits we'll build on this to support the migration from "areas"."areas" to "areas"."ids".
This commit is contained in:
@@ -84,9 +84,13 @@ def test_valid_post_cap_xml_broadcast_returns_201(
|
||||
|
||||
assert response_json['approved_at'] is None
|
||||
assert response_json['approved_by_id'] is None
|
||||
# TEMPORARY: while we repurpose "areas"
|
||||
assert response_json['areas'] == [
|
||||
'River Steeping in Wainfleet All Saints'
|
||||
]
|
||||
assert response_json['areas_2']['areas'] == [
|
||||
'River Steeping in Wainfleet All Saints'
|
||||
]
|
||||
assert response_json['cancelled_at'] is None
|
||||
assert response_json['cancelled_by_id'] is None
|
||||
assert response_json['content'].startswith(
|
||||
@@ -102,10 +106,19 @@ def test_valid_post_cap_xml_broadcast_returns_201(
|
||||
assert response_json['id'] == ANY
|
||||
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['simple_polygons']) == 1
|
||||
assert len(response_json['simple_polygons'][0]) == 23
|
||||
assert response_json['simple_polygons'][0][0] == [53.10562, 0.244127]
|
||||
assert response_json['simple_polygons'][0][-1] == [53.10562, 0.244127]
|
||||
assert response_json['simple_polygons'][0][-1] == [53.10562, 0.244127]
|
||||
assert len(response_json['areas_2']['simple_polygons']) == 1
|
||||
assert len(response_json['areas_2']['simple_polygons'][0]) == 23
|
||||
assert response_json['areas_2']['simple_polygons'][0][0] == [53.10562, 0.244127]
|
||||
assert response_json['areas_2']['simple_polygons'][0][-1] == [53.10562, 0.244127]
|
||||
assert response_json['areas_2']['simple_polygons'][0][-1] == [53.10562, 0.244127]
|
||||
|
||||
assert response_json['starts_at'] is None
|
||||
assert response_json['status'] == 'pending-approval'
|
||||
assert response_json['template_id'] is None
|
||||
|
||||
Reference in New Issue
Block a user