diff --git a/app/templates/components/table.html b/app/templates/components/table.html index 2c43ecbe2..c24f1ba6e 100644 --- a/app/templates/components/table.html +++ b/app/templates/components/table.html @@ -162,7 +162,7 @@ notification.template.template_type ) }} {% endif %} - {% if notification.notification_type == "letter" and notification.status == 'permanent-failure' %} + {% if notification.notification_type == "letter" and notification.status in ['permanent-failure', 'validation-failed'] %} Cancelled {% endif %} {% if notification.status|format_notification_status_as_url(notification.notification_type) %} diff --git a/app/templates/views/notifications/notification.html b/app/templates/views/notifications/notification.html index 2c2e9788a..15fbc194a 100644 --- a/app/templates/views/notifications/notification.html +++ b/app/templates/views/notifications/notification.html @@ -39,6 +39,11 @@
Cancelled {{ updated_at|format_datetime_short }}
+ {% elif notification_status == 'validation-failed' %} ++ Cancelled {{ updated_at|format_datetime_short }} + (letter has content outside the printable area) +
{% else %}Postage: {{ postage }} class diff --git a/tests/app/main/views/test_activity.py b/tests/app/main/views/test_activity.py index e9727f171..f1e9623f0 100644 --- a/tests/app/main/views/test_activity.py +++ b/tests/app/main/views/test_activity.py @@ -547,6 +547,7 @@ 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), ] ) def test_sending_status_hint_does_not_include_status_for_letters( diff --git a/tests/app/main/views/test_notifications.py b/tests/app/main/views/test_notifications.py index 82fc55e22..c89d0bae8 100644 --- a/tests/app/main/views/test_notifications.py +++ b/tests/app/main/views/test_notifications.py @@ -174,18 +174,30 @@ def test_notification_page_shows_page_for_letter_notification( ) +@pytest.mark.parametrize('notification_status, expected_message', ( + ( + 'permanent-failure', + 'Cancelled 1 January at 1:02am', + ), + ( + 'validation-failed', + 'Cancelled 1 January at 1:02am (letter has content outside the printable area)', + ), +)) @freeze_time("2016-01-01 01:01") def test_notification_page_shows_cancelled_letter( client_request, mocker, fake_uuid, + notification_status, + expected_message, ): mock_get_notification( mocker, fake_uuid, template_type='letter', - notification_status='permanent-failure', + notification_status=notification_status, ) mocker.patch( 'app.main.views.notifications.get_page_count_for_letter', @@ -202,7 +214,7 @@ def test_notification_page_shows_cancelled_letter( 'sample template sent by Test User on 1 January at 1:01am' ) assert normalize_spaces(page.select('main p')[1].text) == ( - 'Cancelled 1 January at 1:02am' + expected_message ) assert not page.select('p.notification-status')