mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-05 02:41:14 -05:00
Check for suspension before sending a broadcast
This mirrors the check we do for jobs, which are also a high-impact
task [1]. While this shouldn't be possible, just like other checks
we're adding it here to be doubly certain.
[1]: 3d71815956/app/celery/tasks.py (L74)
This commit is contained in:
@@ -735,6 +735,19 @@ def test_check_provider_message_should_send_raises_if_current_event_already_has_
|
||||
check_provider_message_should_send(current_event, 'ee')
|
||||
|
||||
|
||||
def test_check_provider_message_should_send_raises_if_service_is_suspended(
|
||||
sample_broadcast_service,
|
||||
):
|
||||
sample_broadcast_service.active = False
|
||||
broadcast_message = create_broadcast_message(service=sample_broadcast_service, content='test')
|
||||
current_event = create_broadcast_event(broadcast_message, message_type='alert')
|
||||
|
||||
with pytest.raises(BroadcastIntegrityError) as exc:
|
||||
check_provider_message_should_send(current_event, 'ee')
|
||||
|
||||
assert 'service is suspended' in str(exc.value)
|
||||
|
||||
|
||||
def test_send_broadcast_provider_message_does_nothing_if_cbc_proxy_disabled(mocker, notify_api, sample_template):
|
||||
mock_proxy_client_getter = mocker.patch(
|
||||
'app.celery.broadcast_message_tasks.cbc_proxy_client',
|
||||
|
||||
Reference in New Issue
Block a user