From f1c75c5c5db3e532ab157414e9da6d257d4476b0 Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Mon, 15 Jan 2018 14:22:09 +0000 Subject: [PATCH] Change notification status of failed letters - Changed the notification status of letters for letters that DVLA marks as 'failed' from NOTIFICATION_TECHNICAL_FAILURE to NOTIFICATION_TEMPORARY_FAILURE. --- app/celery/tasks.py | 3 ++- tests/app/celery/test_ftp_update_tasks.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/celery/tasks.py b/app/celery/tasks.py index 57a7c5bc8..3b065f9fc 100644 --- a/app/celery/tasks.py +++ b/app/celery/tasks.py @@ -63,6 +63,7 @@ from app.models import ( LETTER_TYPE, NOTIFICATION_DELIVERED, NOTIFICATION_SENDING, + NOTIFICATION_TEMPORARY_FAILURE, NOTIFICATION_TECHNICAL_FAILURE, SMS_TYPE, ) @@ -476,7 +477,7 @@ def update_letter_notifications_statuses(self, filename): else: for update in notification_updates: status = NOTIFICATION_DELIVERED if update.status == DVLA_RESPONSE_STATUS_SENT \ - else NOTIFICATION_TECHNICAL_FAILURE + else NOTIFICATION_TEMPORARY_FAILURE updated_count = dao_update_notifications_by_reference( references=[update.reference], update_dict={"status": status, diff --git a/tests/app/celery/test_ftp_update_tasks.py b/tests/app/celery/test_ftp_update_tasks.py index 880189297..135f8e240 100644 --- a/tests/app/celery/test_ftp_update_tasks.py +++ b/tests/app/celery/test_ftp_update_tasks.py @@ -10,6 +10,7 @@ from app.models import ( NOTIFICATION_CREATED, NOTIFICATION_DELIVERED, NOTIFICATION_SENDING, + NOTIFICATION_TEMPORARY_FAILURE, NOTIFICATION_TECHNICAL_FAILURE ) from app.celery.tasks import ( @@ -107,7 +108,7 @@ def test_update_letter_notifications_statuses_persisted(notify_api, mocker, samp assert sent_letter.status == NOTIFICATION_DELIVERED assert sent_letter.billable_units == 1 assert sent_letter.updated_at - assert failed_letter.status == NOTIFICATION_TECHNICAL_FAILURE + assert failed_letter.status == NOTIFICATION_TEMPORARY_FAILURE assert failed_letter.billable_units == 2 assert failed_letter.updated_at