mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-10 13:23:40 -05:00
Merge pull request #1743 from alphagov/all-pages-letter
Show all pages of a sent letter
This commit is contained in:
@@ -14,7 +14,7 @@ from app import (
|
||||
current_service
|
||||
)
|
||||
from app.main import main
|
||||
from app.template_previews import TemplatePreview
|
||||
from app.template_previews import TemplatePreview, get_page_count_for_letter
|
||||
from app.utils import (
|
||||
user_has_permissions,
|
||||
get_help_argument,
|
||||
@@ -40,6 +40,7 @@ def view_notification(service_id, notification_id):
|
||||
notification_id=notification_id,
|
||||
filetype='png',
|
||||
),
|
||||
page_count=get_page_count_for_letter(notification['template']),
|
||||
show_recipient=True,
|
||||
redact_missing_personalisation=True,
|
||||
)
|
||||
|
||||
@@ -109,13 +109,19 @@ def test_notification_page_doesnt_link_to_template_in_tour(
|
||||
|
||||
|
||||
@freeze_time("2016-01-01 01:01")
|
||||
def test_notification_page_shows_status_of_letter_notification(
|
||||
def test_notification_page_shows_page_for_letter_notification(
|
||||
client_request,
|
||||
mocker,
|
||||
fake_uuid,
|
||||
):
|
||||
|
||||
count_of_pages = 3
|
||||
|
||||
mock_get_notification(mocker, fake_uuid, template_type='letter')
|
||||
mocker.patch(
|
||||
'app.main.views.notifications.get_page_count_for_letter',
|
||||
return_value=count_of_pages
|
||||
)
|
||||
|
||||
page = client_request.get(
|
||||
'main.view_notification',
|
||||
@@ -131,6 +137,15 @@ def test_notification_page_shows_status_of_letter_notification(
|
||||
)
|
||||
assert page.select('p.notification-status') == []
|
||||
|
||||
letter_images = page.select('main img')
|
||||
|
||||
assert len(letter_images) == count_of_pages
|
||||
|
||||
for index in range(1, count_of_pages + 1):
|
||||
assert page.select('img')[index]['src'].endswith(
|
||||
'.png?page={}'.format(index)
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('filetype', [
|
||||
'pdf', 'png'
|
||||
@@ -193,6 +208,10 @@ def test_notification_page_has_link_to_send_another_for_sms(
|
||||
|
||||
service_one['permissions'] = service_permissions
|
||||
mock_get_notification(mocker, fake_uuid, template_type=template_type)
|
||||
mocker.patch(
|
||||
'app.main.views.notifications.get_page_count_for_letter',
|
||||
return_value=1
|
||||
)
|
||||
|
||||
page = client_request.get(
|
||||
'main.view_notification',
|
||||
@@ -237,6 +256,10 @@ def test_notification_page_has_link_to_download_letter(
|
||||
):
|
||||
|
||||
mock_get_notification(mocker, fake_uuid, template_type=template_type)
|
||||
mocker.patch(
|
||||
'app.main.views.notifications.get_page_count_for_letter',
|
||||
return_value=1
|
||||
)
|
||||
|
||||
page = client_request.get(
|
||||
'main.view_notification',
|
||||
|
||||
Reference in New Issue
Block a user