mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
Change email status to permanent-failure if SES raises InvalidParameterValue
If SES raised an `InvalidParameterValue` error (because an email address was wrong) we were logging an exception and setting the email status to `technical-failure`. We now set it to `permanent-failure` instead and change the log level to `info` - setting it to `permanent-failure` means that people will know not to retry the message.
This commit is contained in:
@@ -84,14 +84,14 @@ def test_should_go_into_technical_error_if_exceeds_retries_on_deliver_email_task
|
||||
assert str(sample_notification.id) in e.value.message
|
||||
|
||||
|
||||
def test_should_technical_error_and_not_retry_if_invalid_email(sample_notification, mocker):
|
||||
def test_should_go_into_permanent_failure_and_not_retry_if_invalid_email(sample_notification, mocker):
|
||||
mocker.patch('app.delivery.send_to_providers.send_email_to_provider', side_effect=InvalidEmailError('bad email'))
|
||||
mocker.patch('app.celery.provider_tasks.deliver_email.retry')
|
||||
|
||||
deliver_email(sample_notification.id)
|
||||
|
||||
assert provider_tasks.deliver_email.retry.called is False
|
||||
assert sample_notification.status == 'technical-failure'
|
||||
assert sample_notification.status == 'permanent-failure'
|
||||
|
||||
|
||||
def test_should_retry_and_log_exception(sample_notification, mocker):
|
||||
|
||||
Reference in New Issue
Block a user