mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 14:31:57 -05:00
Mirror integrity checks from the API
It makes sense to have these checks [1] here, since in future we may
add other ways of creating a broadcast event and omit them.
[1]: 3d71815956/app/broadcast_message/rest.py (L198)
This commit is contained in:
@@ -748,6 +748,31 @@ def test_check_provider_message_should_send_raises_if_service_is_suspended(
|
||||
assert 'service is suspended' in str(exc.value)
|
||||
|
||||
|
||||
def test_check_provider_message_should_send_raises_if_service_is_not_live(
|
||||
sample_broadcast_service,
|
||||
):
|
||||
sample_broadcast_service.restricted = True
|
||||
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 not live' in str(exc.value)
|
||||
|
||||
|
||||
def test_check_provider_message_should_send_raises_if_message_is_stubbed(
|
||||
sample_template,
|
||||
):
|
||||
broadcast_message = create_broadcast_message(sample_template, stubbed=True)
|
||||
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 'message is stubbed' 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