From 54808104a61d66c4d1bbe683b7954ee1e1c38768 Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Mon, 6 Sep 2021 12:46:37 +0100 Subject: [PATCH] Stop defaulting simple_polygons to empty array This is now done by the Admin app [1]. [1]: https://github.com/alphagov/notifications-admin/pull/4014/commits/baf20e00751f6cfc6b84ce969988a85d04cc3a0d --- app/models.py | 5 +---- tests/app/broadcast_message/test_rest.py | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/models.py b/app/models.py index 742c42f13..360830dc9 100644 --- a/app/models.py +++ b/app/models.py @@ -2336,9 +2336,6 @@ class BroadcastMessage(db.Model): self._personalisation = encryption.encrypt(personalisation or {}) def serialize(self): - areas = dict(self.areas) - areas["simple_polygons"] = areas.get("simple_polygons", []) - return { 'id': str(self.id), 'reference': self.reference, @@ -2351,7 +2348,7 @@ class BroadcastMessage(db.Model): 'personalisation': self.personalisation if self.template else None, 'content': self.content, - 'areas': areas, + 'areas': self.areas, 'status': self.status, 'starts_at': get_dt_string_or_none(self.starts_at), diff --git a/tests/app/broadcast_message/test_rest.py b/tests/app/broadcast_message/test_rest.py index 57c6edc19..0bf97dc2e 100644 --- a/tests/app/broadcast_message/test_rest.py +++ b/tests/app/broadcast_message/test_rest.py @@ -160,7 +160,7 @@ def test_create_broadcast_message(admin_request, sample_broadcast_service, train assert response['created_at'] is not None assert response['created_by_id'] == str(t.created_by_id) assert response['personalisation'] == {} - assert response['areas']['simple_polygons'] == [] + assert response['areas'] == {} assert response['content'] == 'Some content\n€ŷŵ~\n\'\'""---' broadcast_message = dao_get_broadcast_message_by_id_and_service_id(response["id"], sample_broadcast_service.id)