mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-24 09:21:39 -05:00
Add test coverage for broadcast status transition
This was mentioned in an old pen test report that you could send a request twice to set a broadcast message as broadcasting which would trigger us to send two alerts. It looks like this is now fixed and this test coverage backs that up. Note, it's unlikely that it would have been an issue anyway as the CBC would likely have rejected the message as it would notice it is a duplicate. Note, this test coverage is not supposed to be exhaustive of all the potential transitions but covers the vast majority of ones that we care about. See `BroadcastStatusType.ALLOWED_STATUS_TRANSITIONS` for allowed transitions.
This commit is contained in:
@@ -804,10 +804,31 @@ def test_update_broadcast_message_status_rejects_approval_from_user_not_on_that_
|
||||
|
||||
@pytest.mark.parametrize('current_status, new_status', [
|
||||
(BroadcastStatusType.DRAFT, BroadcastStatusType.DRAFT),
|
||||
(BroadcastStatusType.BROADCASTING, BroadcastStatusType.PENDING_APPROVAL),
|
||||
(BroadcastStatusType.COMPLETED, BroadcastStatusType.BROADCASTING),
|
||||
(BroadcastStatusType.CANCELLED, BroadcastStatusType.DRAFT),
|
||||
(BroadcastStatusType.DRAFT, BroadcastStatusType.BROADCASTING),
|
||||
(BroadcastStatusType.DRAFT, BroadcastStatusType.CANCELLED),
|
||||
|
||||
(BroadcastStatusType.PENDING_APPROVAL, BroadcastStatusType.PENDING_APPROVAL),
|
||||
(BroadcastStatusType.PENDING_APPROVAL, BroadcastStatusType.CANCELLED),
|
||||
(BroadcastStatusType.PENDING_APPROVAL, BroadcastStatusType.COMPLETED),
|
||||
|
||||
(BroadcastStatusType.REJECTED, BroadcastStatusType.REJECTED),
|
||||
(BroadcastStatusType.REJECTED, BroadcastStatusType.BROADCASTING),
|
||||
(BroadcastStatusType.REJECTED, BroadcastStatusType.CANCELLED),
|
||||
(BroadcastStatusType.REJECTED, BroadcastStatusType.COMPLETED),
|
||||
|
||||
(BroadcastStatusType.BROADCASTING, BroadcastStatusType.DRAFT),
|
||||
(BroadcastStatusType.BROADCASTING, BroadcastStatusType.PENDING_APPROVAL),
|
||||
(BroadcastStatusType.BROADCASTING, BroadcastStatusType.BROADCASTING),
|
||||
|
||||
(BroadcastStatusType.COMPLETED, BroadcastStatusType.DRAFT),
|
||||
(BroadcastStatusType.COMPLETED, BroadcastStatusType.PENDING_APPROVAL),
|
||||
(BroadcastStatusType.COMPLETED, BroadcastStatusType.BROADCASTING),
|
||||
(BroadcastStatusType.COMPLETED, BroadcastStatusType.CANCELLED),
|
||||
|
||||
(BroadcastStatusType.CANCELLED, BroadcastStatusType.DRAFT),
|
||||
(BroadcastStatusType.CANCELLED, BroadcastStatusType.PENDING_APPROVAL),
|
||||
(BroadcastStatusType.CANCELLED, BroadcastStatusType.BROADCASTING),
|
||||
(BroadcastStatusType.CANCELLED, BroadcastStatusType.COMPLETED),
|
||||
])
|
||||
def test_update_broadcast_message_status_restricts_status_transitions_to_explicit_list(
|
||||
admin_request,
|
||||
|
||||
Reference in New Issue
Block a user