mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-07 02:48:25 -04:00
Merge pull request #2651 from alphagov/tech-failure-for-letters
Show letters that have gone into ‘technical failure’
This commit is contained in:
@@ -362,18 +362,20 @@ def format_notification_status(status, template_type):
|
|||||||
'sent': 'Sent internationally'
|
'sent': 'Sent internationally'
|
||||||
},
|
},
|
||||||
'letter': {
|
'letter': {
|
||||||
'failed': 'Failed',
|
'failed': '',
|
||||||
'technical-failure': 'Technical failure',
|
'technical-failure': 'Technical failure',
|
||||||
'temporary-failure': 'Temporary failure',
|
'temporary-failure': '',
|
||||||
'permanent-failure': 'Permanent failure',
|
'permanent-failure': '',
|
||||||
'delivered': 'Delivered',
|
'delivered': '',
|
||||||
'sending': 'Sending',
|
'received': '',
|
||||||
'created': 'Sending',
|
'accepted': '',
|
||||||
'sent': 'Delivered',
|
'sending': '',
|
||||||
'pending-virus-check': 'Pending virus check',
|
'created': '',
|
||||||
|
'sent': '',
|
||||||
|
'pending-virus-check': '',
|
||||||
'virus-scan-failed': 'Virus detected',
|
'virus-scan-failed': 'Virus detected',
|
||||||
'returned-letter': 'Delivered',
|
'returned-letter': '',
|
||||||
'cancelled': 'Cancelled,',
|
'cancelled': '',
|
||||||
'validation-failed': 'Validation failed',
|
'validation-failed': 'Validation failed',
|
||||||
}
|
}
|
||||||
}[template_type].get(status, status)
|
}[template_type].get(status, status)
|
||||||
|
|||||||
@@ -144,7 +144,7 @@
|
|||||||
|
|
||||||
{% macro notification_status_field(notification) %}
|
{% macro notification_status_field(notification) %}
|
||||||
|
|
||||||
{% set displayed_on_single_line = notification.status in ['created', 'pending', 'sending', 'delivered'] %}
|
{% set displayed_on_single_line = notification.status in ['created', 'pending', 'pending-virus-check', 'sending', 'sent', 'delivered', 'returned-letter', 'accepted', 'received', 'permanent-failure'] %}
|
||||||
|
|
||||||
{% if not notification %}
|
{% if not notification %}
|
||||||
{% call field(align='right') %}{% endcall %}
|
{% call field(align='right') %}{% endcall %}
|
||||||
@@ -157,14 +157,7 @@
|
|||||||
{% if notification.status|format_notification_status_as_url(notification.notification_type) %}
|
{% if notification.status|format_notification_status_as_url(notification.notification_type) %}
|
||||||
<a href="{{ notification.status|format_notification_status_as_url(notification.notification_type) }}">
|
<a href="{{ notification.status|format_notification_status_as_url(notification.notification_type) }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if notification['notification_type'] != "letter" or notification.status in ('virus-scan-failed', 'validation-failed') %}
|
{{ notification.status|format_notification_status(notification.template.template_type) }}
|
||||||
{{ notification.status|format_notification_status(
|
|
||||||
notification.template.template_type
|
|
||||||
) }}
|
|
||||||
{% endif %}
|
|
||||||
{% 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) %}
|
{% if notification.status|format_notification_status_as_url(notification.notification_type) %}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -45,6 +45,11 @@
|
|||||||
<p class="notification-status-cancelled">
|
<p class="notification-status-cancelled">
|
||||||
Validation failed – content is outside the printable area
|
Validation failed – content is outside the printable area
|
||||||
</p>
|
</p>
|
||||||
|
{% elif notification_status == 'technical-failure' %}
|
||||||
|
<p class="notification-status-cancelled">
|
||||||
|
Technical failure – Notify will resend once the team have
|
||||||
|
fixed the problem
|
||||||
|
</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>
|
<p>
|
||||||
{{ letter_print_day }}
|
{{ letter_print_day }}
|
||||||
|
|||||||
@@ -603,9 +603,15 @@ def test_big_numbers_and_search_dont_show_for_letters(
|
|||||||
"message_type, status, expected_hint_status, single_line", [
|
"message_type, status, expected_hint_status, single_line", [
|
||||||
('email', 'delivered', 'Delivered 27 September at 5:31pm', True),
|
('email', 'delivered', 'Delivered 27 September at 5:31pm', True),
|
||||||
('sms', 'delivered', 'Delivered 27 September at 5:31pm', True),
|
('sms', 'delivered', 'Delivered 27 September at 5:31pm', True),
|
||||||
|
('letter', 'created', '27 September at 5:30pm', True),
|
||||||
|
('letter', 'sending', '27 September at 5:30pm', True),
|
||||||
('letter', 'delivered', '27 September at 5:30pm', True),
|
('letter', 'delivered', '27 September at 5:30pm', True),
|
||||||
('letter', 'permanent-failure', 'Cancelled 27 September at 5:31pm', False),
|
('letter', 'received', '27 September at 5:30pm', True),
|
||||||
|
('letter', 'accepted', '27 September at 5:30pm', True),
|
||||||
|
('letter', 'permanent-failure', '27 September at 5:31pm', True),
|
||||||
|
('letter', 'virus-scan-failed', 'Virus detected 27 September at 5:30pm', False),
|
||||||
('letter', 'validation-failed', 'Validation failed 27 September at 5:30pm', False),
|
('letter', 'validation-failed', 'Validation failed 27 September at 5:30pm', False),
|
||||||
|
('letter', 'technical-failure', 'Technical failure 27 September at 5:30pm', False),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
def test_sending_status_hint_displays_correctly_on_notifications_page(
|
def test_sending_status_hint_displays_correctly_on_notifications_page(
|
||||||
|
|||||||
@@ -191,13 +191,26 @@ def test_notification_page_shows_page_for_letter_notification(
|
|||||||
assert mock_page_count.call_args_list[0][1]['values'] == {'name': 'Jo'}
|
assert mock_page_count.call_args_list[0][1]['values'] == {'name': 'Jo'}
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('notification_status, expected_message', [
|
@pytest.mark.parametrize('notification_status, expected_message', (
|
||||||
('permanent-failure', 'Cancelled 1 January at 1:02am'),
|
(
|
||||||
('cancelled', 'Cancelled 1 January at 1:02am'),
|
'permanent-failure',
|
||||||
('validation-failed', 'Validation failed – content is outside the printable area'),
|
'Cancelled 1 January at 1:02am',
|
||||||
])
|
),
|
||||||
|
(
|
||||||
|
'cancelled',
|
||||||
|
'Cancelled 1 January at 1:02am',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'validation-failed',
|
||||||
|
'Validation failed – content is outside the printable area',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'technical-failure',
|
||||||
|
'Technical failure – Notify will resend once the team have fixed the problem',
|
||||||
|
),
|
||||||
|
))
|
||||||
@freeze_time("2016-01-01 01:01")
|
@freeze_time("2016-01-01 01:01")
|
||||||
def test_notification_page_shows_cancelled_letter(
|
def test_notification_page_shows_cancelled_or_failed_letter(
|
||||||
client_request,
|
client_request,
|
||||||
mocker,
|
mocker,
|
||||||
fake_uuid,
|
fake_uuid,
|
||||||
|
|||||||
Reference in New Issue
Block a user