mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Merge pull request #1946 from alphagov/ken-show-provided-as-pdf-for-precompiled-letters
Set template subject to Provided as PDF for precompiled letters
This commit is contained in:
@@ -399,6 +399,8 @@ def add_preview_of_content_to_notifications(notifications):
|
|||||||
**notification
|
**notification
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
if notification['template']['is_precompiled_letter']:
|
||||||
|
notification['template']['subject'] = 'Provided as PDF'
|
||||||
yield dict(
|
yield dict(
|
||||||
preview_of_content=(
|
preview_of_content=(
|
||||||
WithSubjectTemplate(
|
WithSubjectTemplate(
|
||||||
|
|||||||
@@ -404,3 +404,29 @@ def test_sending_status_hint_does_not_include_status_for_letters(
|
|||||||
assert normalize_spaces(page.select(".align-with-message-body")[0].text) == "27 September at 5:30pm"
|
assert normalize_spaces(page.select(".align-with-message-body")[0].text) == "27 September at 5:30pm"
|
||||||
else:
|
else:
|
||||||
assert normalize_spaces(page.select(".align-with-message-body")[0].text) == "Delivered 27 September at 5:31pm"
|
assert normalize_spaces(page.select(".align-with-message-body")[0].text) == "Delivered 27 September at 5:31pm"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("is_precompiled_letter,expected_hint", [
|
||||||
|
(True, "Provided as PDF"),
|
||||||
|
(False, "template subject")
|
||||||
|
])
|
||||||
|
def test_should_expected_hint_for_letters(
|
||||||
|
logged_in_client,
|
||||||
|
service_one,
|
||||||
|
active_user_with_permissions,
|
||||||
|
mock_get_detailed_service,
|
||||||
|
mocker,
|
||||||
|
fake_uuid,
|
||||||
|
is_precompiled_letter,
|
||||||
|
expected_hint
|
||||||
|
):
|
||||||
|
mock_get_notifications(
|
||||||
|
mocker, active_user_with_permissions, is_precompiled_letter=is_precompiled_letter)
|
||||||
|
|
||||||
|
response = logged_in_client.get(url_for(
|
||||||
|
'main.view_notifications',
|
||||||
|
service_id=SERVICE_ONE_ID,
|
||||||
|
message_type='letter'
|
||||||
|
))
|
||||||
|
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||||
|
assert page.find('p', {'class': 'file-list-hint'}).text.strip() == expected_hint
|
||||||
|
|||||||
@@ -1763,6 +1763,7 @@ def mock_get_notifications(
|
|||||||
diff_template_type=None,
|
diff_template_type=None,
|
||||||
personalisation=None,
|
personalisation=None,
|
||||||
redact_personalisation=False,
|
redact_personalisation=False,
|
||||||
|
is_precompiled_letter=False,
|
||||||
):
|
):
|
||||||
def _get_notifications(
|
def _get_notifications(
|
||||||
service_id,
|
service_id,
|
||||||
@@ -1787,6 +1788,7 @@ def mock_get_notifications(
|
|||||||
type_=diff_template_type or template_type[0],
|
type_=diff_template_type or template_type[0],
|
||||||
content=template_content,
|
content=template_content,
|
||||||
redact_personalisation=redact_personalisation,
|
redact_personalisation=redact_personalisation,
|
||||||
|
is_precompiled_letter=is_precompiled_letter,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
template = template_json(
|
template = template_json(
|
||||||
|
|||||||
Reference in New Issue
Block a user