Return 404 if reference from cancel message does not match

If the reference from cancel CAP XML we received via API does not
match with any existing broadcast, return 404.

Do the same if service id doesn't match.

Also refactor code to cancel broadcast out into separate function

It should be a separate function that is only called by create_broadcast
function. This will prevent create_broadcast from becoming too
big and complex and doing too many things.
This commit is contained in:
Pea Tyczynska
2022-01-14 16:46:20 +00:00
parent 3b4a9d8942
commit a4c20e8ba6
4 changed files with 65 additions and 17 deletions

View File

@@ -189,7 +189,7 @@ WITH_PLACEHOLDER_FOR_CONTENT = """
WINDEMERE = """
<alert xmlns="urn:oasis:names:tc:emergency:cap:1.2">
<identifier>50385fcb0ab7aa447bbd46d848ce8466E</identifier>
<identifier>4f6d28b10ab7aa447bbd46d85f1e9effE</identifier>
<sender>www.gov.uk/environment-agency</sender>
<sent>2020-02-16T23:01:13-00:00</sent>
<status>Actual</status>