Switch to using temporary "areas_2" API field

Depends on: https://github.com/alphagov/notifications-api/pull/3312

This is part of a multi-stage migration where we want to repurpose
the "areas" field in the existing API to something like "areas_2".
This commit is contained in:
Ben Thorner
2021-08-25 17:17:05 +01:00
parent de9d1f991b
commit 11cbee5843
3 changed files with 49 additions and 30 deletions

View File

@@ -696,10 +696,10 @@ def broadcast_message_json(
'reference': reference,
'personalisation': {},
'areas': area_ids or [
'ctry19-E92000001', 'ctry19-S92000003',
],
'simple_polygons': simple_polygons or [],
'areas_2': {
'ids': area_ids or ['ctry19-E92000001', 'ctry19-S92000003'],
'simple_polygons': simple_polygons or [],
},
'status': status,

View File

@@ -1395,7 +1395,10 @@ def test_add_broadcast_area(
service_id=SERVICE_ONE_ID,
broadcast_message_id=fake_uuid,
data={
'areas': ['ctry19-E92000001', 'ctry19-S92000003', 'ctry19-W92000004'], 'simple_polygons': coordinates
'areas_2': {
'ids': ['ctry19-E92000001', 'ctry19-S92000003', 'ctry19-W92000004'],
'simple_polygons': coordinates
}
},
)
@@ -1450,12 +1453,14 @@ def test_add_broadcast_sub_area_district_view(
service_id=SERVICE_ONE_ID,
broadcast_message_id=fake_uuid,
data={
'simple_polygons': coordinates,
'areas': [
# These two areas are on the broadcast already
'ctry19-E92000001',
'ctry19-S92000003',
] + expected_selected
'areas_2': {
'simple_polygons': coordinates,
'ids': [
# These two areas are on the broadcast already
'ctry19-E92000001',
'ctry19-S92000003',
] + expected_selected
}
},
)
@@ -1488,14 +1493,16 @@ def test_add_broadcast_sub_area_county_view(
service_id=SERVICE_ONE_ID,
broadcast_message_id=fake_uuid,
data={
'simple_polygons': coordinates,
'areas': [
# These two areas are on the broadcast already
'ctry19-E92000001',
'ctry19-S92000003',
] + [
'ctyua19-E10000016'
]
'areas_2': {
'simple_polygons': coordinates,
'ids': [
# These two areas are on the broadcast already
'ctry19-E92000001',
'ctry19-S92000003',
] + [
'ctyua19-E10000016'
]
}
},
)
@@ -1532,8 +1539,10 @@ def test_remove_broadcast_area_page(
service_id=SERVICE_ONE_ID,
broadcast_message_id=fake_uuid,
data={
'simple_polygons': coordinates,
'areas': ['ctry19-S92000003']
'areas_2': {
'simple_polygons': coordinates,
'ids': ['ctry19-S92000003']
},
},
)