Files
notifications-admin/tests/app/main/views/test_notifications.py
Chris Hill-Scott 67b2937123 Show full message content on notification page
We’ve had a few teams talk about wanting to go back and check what their
users are sending out, including the content of any placeholders.

We already provide this functionality through the API, this commit makes
it the default in the admin app too.

We couldn’t do this before because we didn’t have the individual
notification page.

It’s better to do this by re-hydrating the template than pulling the
content from the API, because things like letters have multiple areas
of content – this is more complex than what we can get from API at the
moment.
2017-06-21 16:20:45 +01:00

57 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from freezegun import freeze_time
import pytest
from app.utils import (
REQUESTED_STATUSES,
FAILURE_STATUSES,
SENDING_STATUSES,
DELIVERED_STATUSES,
)
from tests.app.test_utils import normalize_spaces
from tests.conftest import mock_get_notification
@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'),
])
@freeze_time("2016-01-01 11:09:00.061258")
def test_notification_status_page_shows_details(
client_request,
mocker,
service_one,
fake_uuid,
notification_status,
expected_status,
):
_mock_get_notification = mock_get_notification(
mocker,
fake_uuid,
notification_status=notification_status
)
page = client_request.get(
'main.view_notification',
service_id=service_one['id'],
notification_id=fake_uuid
)
assert normalize_spaces(page.select('.sms-message-wrapper')[0].text) == (
'service one: hello Jo'
)
assert normalize_spaces(page.select('.ajax-block-container p')[0].text) == (
expected_status
)
_mock_get_notification.assert_called_with(
service_one['id'],
fake_uuid
)