From bb7e9726d3cab72248ecebdf135bb6e0aa14faf9 Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Mon, 7 Jan 2019 12:02:24 +0000 Subject: [PATCH] Stop showing validation-failed letters as cancelled in table Changed the table for displaying all notifications to show letters which have the status of 'validation-failed' as 'Validation failed' instead of 'Cancelled'. The individual notification page for a letter which has failed validation has not been changed since this already has a description (letter has content outside the printable area). --- app/__init__.py | 3 ++- app/templates/components/table.html | 4 ++-- tests/app/main/views/test_activity.py | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 0221981a8..75837af07 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -373,7 +373,8 @@ def format_notification_status(status, template_type): 'pending-virus-check': 'Pending virus check', 'virus-scan-failed': 'Virus detected', 'returned-letter': 'Delivered', - 'cancelled': 'Cancelled,' + 'cancelled': 'Cancelled,', + 'validation-failed': 'Validation failed', } }[template_type].get(status, status) diff --git a/app/templates/components/table.html b/app/templates/components/table.html index cb5622c60..b4863e947 100644 --- a/app/templates/components/table.html +++ b/app/templates/components/table.html @@ -157,12 +157,12 @@ {% if notification.status|format_notification_status_as_url(notification.notification_type) %} {% endif %} - {% if notification['notification_type'] != "letter" or notification.status == 'virus-scan-failed' %} + {% if notification['notification_type'] != "letter" or notification.status in ('virus-scan-failed', 'validation-failed') %} {{ notification.status|format_notification_status( notification.template.template_type ) }} {% endif %} - {% if notification.notification_type == "letter" and notification.status in ['permanent-failure', 'validation-failed', 'cancelled'] %} + {% if notification.notification_type == "letter" and notification.status in ['permanent-failure', 'cancelled'] %} Cancelled {% endif %} {% if notification.status|format_notification_status_as_url(notification.notification_type) %} diff --git a/tests/app/main/views/test_activity.py b/tests/app/main/views/test_activity.py index b6c2f1a52..3e4fb7e10 100644 --- a/tests/app/main/views/test_activity.py +++ b/tests/app/main/views/test_activity.py @@ -602,10 +602,10 @@ def test_big_numbers_and_search_dont_show_for_letters( ('sms', 'delivered', 'Delivered 27 September at 5:31pm', True), ('letter', 'delivered', '27 September at 5:30pm', True), ('letter', 'permanent-failure', 'Cancelled 27 September at 5:31pm', False), - ('letter', 'validation-failed', 'Cancelled 27 September at 5:30pm', False), + ('letter', 'validation-failed', 'Validation failed 27 September at 5:30pm', False), ] ) -def test_sending_status_hint_does_not_include_status_for_letters( +def test_sending_status_hint_displays_correctly_on_notifications_page( client_request, service_one, active_user_with_permissions,