From 288f5d11cd16b5d1b43ebee7ddf6ba521266c7ba Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 14 Feb 2022 14:30:11 +0000 Subject: [PATCH 1/2] Test that alert with no references is OK References are optional, and we fixed errors when they are not provided in bbc444699a6032ef855959d81aee905775be9862 This commit amends the tests so that they cover the `Alert` message type as well as the `Cancel` (which is already covered). --- tests/app/v2/broadcast/sample_cap_xml_documents.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/app/v2/broadcast/sample_cap_xml_documents.py b/tests/app/v2/broadcast/sample_cap_xml_documents.py index 146919125..d4e62bbb7 100644 --- a/tests/app/v2/broadcast/sample_cap_xml_documents.py +++ b/tests/app/v2/broadcast/sample_cap_xml_documents.py @@ -9,7 +9,6 @@ WAINFLEET = """ Alert Flood warning service Public - www.gov.uk/environment-agency,4f6d28b10ab7aa447bbd46d85f1e9effE,2020-02-16T19:20:03+00:00 en-GB Met From d73131bbec089d30de052b7240fbb01f002665c0 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 14 Feb 2022 14:34:25 +0000 Subject: [PATCH 2/2] Allow cancel of alert via API with no description The XML for an alerts requires a `` field. The XML for a `` may have a `` field populated (although we ignore the contents) but it may also be empty. This commit updates the schema to leave the all the validation to the view layer, which can decide when or when not to validate the content of the `` field. --- app/v2/broadcast/broadcast_schemas.py | 2 +- tests/app/v2/broadcast/sample_cap_xml_documents.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/v2/broadcast/broadcast_schemas.py b/app/v2/broadcast/broadcast_schemas.py index bd77df612..f7d97f8a2 100644 --- a/app/v2/broadcast/broadcast_schemas.py +++ b/app/v2/broadcast/broadcast_schemas.py @@ -52,7 +52,7 @@ post_broadcast_schema = { }, "content": { "type": "string", - "minLength": 1, + "minLength": 0, }, "web": { "type": "string", diff --git a/tests/app/v2/broadcast/sample_cap_xml_documents.py b/tests/app/v2/broadcast/sample_cap_xml_documents.py index d4e62bbb7..20a107261 100644 --- a/tests/app/v2/broadcast/sample_cap_xml_documents.py +++ b/tests/app/v2/broadcast/sample_cap_xml_documents.py @@ -54,7 +54,7 @@ WAINFLEET_CANCEL = """ Likely 2020-02-16T23:30:13-00:00 Environment Agency - Cancel Warning + https://flood-warning-information.service.gov.uk 0345 988 1188