mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-03 05:11:03 -04:00
Link to notification from API integration
It’s useful to be able to see what the email or text message looks like, especially if you’ve sent it with a test API key (so it isn’t in your inbox or on your phone). We already have the page for this, so we just need to link to it.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
{% from "components/table.html" import list_table, field, hidden_field_heading %}
|
||||
{% from "components/api-key.html" import api_key %}
|
||||
{% from "components/banner.html" import banner_wrapper %}
|
||||
{% from "components/message-count-label.html" import message_count_label %}
|
||||
|
||||
{% block service_page_title %}
|
||||
API integration
|
||||
@@ -73,8 +74,8 @@
|
||||
<dd class="api-notifications-item-data-item">{{ notification[key] }}</dd>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if notification['notification_type'] == 'letter' and notification.status not in ('pending-virus-check', 'virus-scan-failed') %}
|
||||
<a href="{{ url_for('.view_notification', service_id=current_service.id, notification_id=notification.id) }}">View letter</a>
|
||||
{% if notification.status not in ('pending-virus-check', 'virus-scan-failed') %}
|
||||
<a href="{{ url_for('.view_notification', service_id=current_service.id, notification_id=notification.id) }}">View {{ message_count_label(1, notification.template.template_type, suffix='') }}</a>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@@ -70,27 +70,26 @@ def test_should_show_api_page_with_no_notifications(
|
||||
assert 'When you send messages via the API they’ll appear here.' in rows[len(rows) - 1].text.strip()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('template_type, has_links', [
|
||||
('sms', False),
|
||||
('letter', True),
|
||||
@pytest.mark.parametrize('template_type, link_text', [
|
||||
('sms', 'View text message'),
|
||||
('letter', 'View letter'),
|
||||
('email', 'View email'),
|
||||
])
|
||||
def test_letter_notifications_should_have_link_to_view_letter(
|
||||
client_request,
|
||||
api_user_active,
|
||||
fake_uuid,
|
||||
mock_has_permissions,
|
||||
mocker,
|
||||
template_type,
|
||||
has_links
|
||||
link_text,
|
||||
):
|
||||
mock_get_notifications(mocker, api_user_active, diff_template_type=template_type)
|
||||
|
||||
page = client_request.get(
|
||||
'main.api_integration',
|
||||
service_id=fake_uuid,
|
||||
service_id=SERVICE_ONE_ID,
|
||||
)
|
||||
|
||||
assert (page.select_one('details a') is not None) == has_links
|
||||
assert page.select_one('details a').text.strip() == link_text
|
||||
|
||||
|
||||
@pytest.mark.parametrize('status', [
|
||||
|
||||
@@ -285,7 +285,7 @@ def test_should_show_letter_job(
|
||||
)
|
||||
assert page.select('.banner-default-with-tick') == []
|
||||
assert normalize_spaces(page.select('tbody tr')[0].text) == (
|
||||
'1 Example Street template content 1 January at 11:09am'
|
||||
'1 Example Street template subject 1 January at 11:09am'
|
||||
)
|
||||
assert normalize_spaces(page.select('.keyline-block')[0].text) == (
|
||||
'1 Letter'
|
||||
|
||||
@@ -1856,7 +1856,7 @@ def mock_get_notifications(
|
||||
job = None
|
||||
if job_id is not None:
|
||||
job = job_json(service_id, api_user_active, job_id=job_id)
|
||||
if template_type:
|
||||
if diff_template_type or template_type:
|
||||
template = template_json(
|
||||
service_id,
|
||||
id_=str(generate_uuid()),
|
||||
|
||||
Reference in New Issue
Block a user