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:
Rebecca Law
2018-03-16 17:18:44 +00:00
parent c9477a7400
commit 0dc50190b2
11 changed files with 65 additions and 30 deletions

View File

@@ -5,7 +5,7 @@ import pytest
from freezegun import freeze_time
from flask import current_app
from app.exceptions import DVLAException
from app.exceptions import DVLAException, NotificationTechnicalFailureException
from app.models import (
Job,
Notification,
@@ -276,7 +276,9 @@ def test_update_letter_notifications_to_error_updates_based_on_notification_refe
create_service_callback_api(service=sample_letter_template.service, url="https://original_url.com")
dt = datetime.utcnow()
with freeze_time(dt):
update_letter_notifications_to_error([first.reference])
with pytest.raises(NotificationTechnicalFailureException) as e:
update_letter_notifications_to_error([first.reference])
assert first.reference in e.value.message
assert first.status == NOTIFICATION_TECHNICAL_FAILURE
assert first.sent_by is None