mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-30 02:38:33 -04:00
Indicate messages sent with a test key
If a message has been sent with a test key it’s a bit confusing to just say ‘Delivered’ on the page, because it hasn’t gone to anyone’s phone. So this commit adds a bit of hint text to disambiguate what ‘Delivered’ actually means in this context.
This commit is contained in:
@@ -25,6 +25,7 @@ from app import (
|
||||
notification_api_client,
|
||||
)
|
||||
from app.main import main
|
||||
from app.notify_client.api_key_api_client import KEY_TYPE_TEST
|
||||
from app.template_previews import get_page_count_for_letter
|
||||
from app.utils import (
|
||||
DELIVERED_STATUSES,
|
||||
@@ -144,7 +145,10 @@ def get_single_notification_partials(notification):
|
||||
),
|
||||
'status': render_template(
|
||||
'partials/notifications/status.html',
|
||||
notification=notification
|
||||
notification=notification,
|
||||
sent_with_test_key=(
|
||||
notification.get('key_type') == KEY_TYPE_TEST
|
||||
),
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
@@ -9,5 +9,8 @@
|
||||
{% if notification.status|format_notification_status_as_url %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if sent_with_test_key %}
|
||||
(test)
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -16,14 +16,19 @@ from tests.conftest import (
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('notification_status, expected_status', [
|
||||
('created', 'Sending'),
|
||||
('sending', 'Sending'),
|
||||
('delivered', 'Delivered'),
|
||||
('failed', 'Failed'),
|
||||
('temporary-failure', 'Phone not accepting messages right now'),
|
||||
('permanent-failure', 'Phone number doesn’t exist'),
|
||||
('technical-failure', 'Technical failure'),
|
||||
@pytest.mark.parametrize('key_type, notification_status, expected_status', [
|
||||
(None, 'created', 'Sending'),
|
||||
(None, 'sending', 'Sending'),
|
||||
(None, 'delivered', 'Delivered'),
|
||||
(None, 'failed', 'Failed'),
|
||||
(None, 'temporary-failure', 'Phone not accepting messages right now'),
|
||||
(None, 'permanent-failure', 'Phone number doesn’t exist'),
|
||||
(None, 'technical-failure', 'Technical failure'),
|
||||
('team', 'delivered', 'Delivered'),
|
||||
('live', 'delivered', 'Delivered'),
|
||||
('test', 'sending', 'Sending (test)'),
|
||||
('test', 'delivered', 'Delivered (test)'),
|
||||
('test', 'permanent-failure', 'Phone number doesn’t exist (test)'),
|
||||
])
|
||||
@pytest.mark.parametrize('user', [
|
||||
active_user_with_permissions,
|
||||
@@ -37,6 +42,7 @@ def test_notification_status_page_shows_details(
|
||||
service_one,
|
||||
fake_uuid,
|
||||
user,
|
||||
key_type,
|
||||
notification_status,
|
||||
expected_status,
|
||||
):
|
||||
@@ -46,7 +52,8 @@ def test_notification_status_page_shows_details(
|
||||
_mock_get_notification = mock_get_notification(
|
||||
mocker,
|
||||
fake_uuid,
|
||||
notification_status=notification_status
|
||||
notification_status=notification_status,
|
||||
key_type=key_type,
|
||||
)
|
||||
|
||||
page = client_request.get(
|
||||
|
||||
@@ -2640,7 +2640,8 @@ def mock_get_notification(
|
||||
redact_personalisation=False,
|
||||
template_type=None,
|
||||
template_name='sample template',
|
||||
is_precompiled_letter=False
|
||||
is_precompiled_letter=False,
|
||||
key_type=None,
|
||||
):
|
||||
def _get_notification(
|
||||
service_id,
|
||||
@@ -2670,6 +2671,8 @@ def mock_get_notification(
|
||||
is_precompiled_letter=is_precompiled_letter,
|
||||
name=template_name
|
||||
)
|
||||
if key_type:
|
||||
noti['key_type'] = key_type
|
||||
return noti
|
||||
|
||||
return mocker.patch(
|
||||
|
||||
Reference in New Issue
Block a user