mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Throw an exception whenever we updated a notification to technical failure.
If this is happening we want to know about it.
This commit is contained in:
@@ -13,6 +13,7 @@ from app import mmg_client, firetext_client
|
||||
from app.dao import (provider_details_dao, notifications_dao)
|
||||
from app.dao.provider_details_dao import dao_switch_sms_provider_to_provider_with_identifier
|
||||
from app.delivery import send_to_providers
|
||||
from app.exceptions import NotificationTechnicalFailureException
|
||||
from app.models import (
|
||||
Notification,
|
||||
EmailBranding,
|
||||
@@ -137,9 +138,11 @@ def test_should_not_send_email_message_when_service_is_inactive_notifcation_is_i
|
||||
sample_service.active = False
|
||||
send_mock = mocker.patch("app.aws_ses_client.send_email", return_value='reference')
|
||||
|
||||
send_to_providers.send_email_to_provider(sample_notification)
|
||||
with pytest.raises(NotificationTechnicalFailureException) as e:
|
||||
send_to_providers.send_email_to_provider(sample_notification)
|
||||
send_mock.assert_not_called()
|
||||
assert Notification.query.get(sample_notification.id).status == 'technical-failure'
|
||||
assert str(sample_notification.id) in e.value.message
|
||||
|
||||
|
||||
@pytest.mark.parametrize("client_send", ["app.mmg_client.send_sms", "app.firetext_client.send_sms"])
|
||||
@@ -148,9 +151,11 @@ def test_should_not_send_sms_message_when_service_is_inactive_notifcation_is_in_
|
||||
sample_service.active = False
|
||||
send_mock = mocker.patch(client_send, return_value='reference')
|
||||
|
||||
send_to_providers.send_sms_to_provider(sample_notification)
|
||||
with pytest.raises(NotificationTechnicalFailureException) as e:
|
||||
send_to_providers.send_sms_to_provider(sample_notification)
|
||||
send_mock.assert_not_called()
|
||||
assert Notification.query.get(sample_notification.id).status == 'technical-failure'
|
||||
assert str(sample_notification.id) in e.value.message
|
||||
|
||||
|
||||
def test_send_sms_should_use_template_version_from_notification_not_latest(
|
||||
|
||||
Reference in New Issue
Block a user