Update NotificationTechnicalFailureException

- Change the NotificationTechnicalFailureException so that it only inherits from Exception.
- The notify_celery task should create the logging message on failure.
- Fix unit tests
- Remove named parameter when raising exception.
This commit is contained in:
Rebecca Law
2019-08-12 16:51:39 +01:00
parent 9d8e8747d1
commit ae1bc54f9e
6 changed files with 9 additions and 12 deletions

View File

@@ -65,11 +65,11 @@ def test_should_go_into_technical_error_if_exceeds_retries_on_deliver_sms_task(s
with pytest.raises(NotificationTechnicalFailureException) as e:
deliver_sms(sample_notification.id)
assert sample_notification.id in e.value
provider_tasks.deliver_sms.retry.assert_called_with(queue="retry-tasks", countdown=0)
assert sample_notification.status == 'technical-failure'
assert str(sample_notification.id) in e.value.message
def test_should_go_into_technical_error_if_exceeds_retries_on_deliver_email_task(sample_notification, mocker):
@@ -78,10 +78,10 @@ def test_should_go_into_technical_error_if_exceeds_retries_on_deliver_email_task
with pytest.raises(NotificationTechnicalFailureException) as e:
deliver_email(sample_notification.id)
assert sample_notification.id in e.value
provider_tasks.deliver_email.retry.assert_called_with(queue="retry-tasks")
assert sample_notification.status == 'technical-failure'
assert str(sample_notification.id) in e.value.message
def test_should_technical_error_and_not_retry_if_invalid_email(sample_notification, mocker):