Merge pull request #2290 from alphagov/link-to-notification

Link to single notification page from API integration page
This commit is contained in:
Chris Hill-Scott
2018-09-07 13:25:57 +01:00
committed by GitHub
7 changed files with 40 additions and 23 deletions

View File

@@ -70,27 +70,26 @@ def test_should_show_api_page_with_no_notifications(
assert 'When you send messages via the API theyll 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', [

View File

@@ -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'

View File

@@ -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 doesnt 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 doesnt 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 doesnt 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(