From 54fe8ee68da00f93bdc19214590dda2cd59bbbbd Mon Sep 17 00:00:00 2001 From: David McDonald Date: Tue, 15 Jun 2021 17:18:54 +0100 Subject: [PATCH] Remove old todo for support of draft to broadcasting transition It looks like we were allowing broadcasts to transition from draft to broadcasting in one go. This isn't valid now. It should go draft, pending approval and then broadcasting. It looks like this was a leftover bit of support in our code for when we were building stuff out and is no longer needed. --- 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 7d3e1b7b8..8e59c01ca 100644 --- a/app/models.py +++ b/app/models.py @@ -2218,10 +2218,7 @@ class BroadcastStatusType(db.Model): # these are only the transitions we expect to administer via the API code. ALLOWED_STATUS_TRANSITIONS = { - DRAFT: { - PENDING_APPROVAL, - BROADCASTING, # TODO: Remove me once we have pending approval flow put in properly - }, + DRAFT: {PENDING_APPROVAL}, PENDING_APPROVAL: {REJECTED, DRAFT, BROADCASTING}, REJECTED: {DRAFT, PENDING_APPROVAL}, BROADCASTING: {COMPLETED, CANCELLED}, diff --git a/tests/app/broadcast_message/test_rest.py b/tests/app/broadcast_message/test_rest.py index 8e8802a2a..77185ba48 100644 --- a/tests/app/broadcast_message/test_rest.py +++ b/tests/app/broadcast_message/test_rest.py @@ -807,7 +807,7 @@ def test_update_broadcast_message_status_rejects_approval_from_user_not_on_that_ (BroadcastStatusType.BROADCASTING, BroadcastStatusType.PENDING_APPROVAL), (BroadcastStatusType.COMPLETED, BroadcastStatusType.BROADCASTING), (BroadcastStatusType.CANCELLED, BroadcastStatusType.DRAFT), - pytest.param(BroadcastStatusType.DRAFT, BroadcastStatusType.BROADCASTING, marks=pytest.mark.xfail()), + (BroadcastStatusType.DRAFT, BroadcastStatusType.BROADCASTING), ]) def test_update_broadcast_message_status_restricts_status_transitions_to_explicit_list( admin_request,