diff --git a/tests/notifications_utils/test_template_types.py b/tests/notifications_utils/test_template_types.py
index bdb69824d..a42e410fa 100644
--- a/tests/notifications_utils/test_template_types.py
+++ b/tests/notifications_utils/test_template_types.py
@@ -1,6 +1,5 @@
import os
import sys
-from functools import partial
from time import process_time
from unittest import mock
@@ -884,440 +883,440 @@ def test_phone_templates_normalise_whitespace(template_class):
)
-@freeze_time("2012-12-12 12:12:12")
-@mock.patch("notifications_utils.template.LetterPreviewTemplate.jinja_template.render")
-@mock.patch("notifications_utils.template.unlink_govuk_escaped")
-@mock.patch(
- "notifications_utils.template.notify_letter_preview_markdown", return_value="Bar"
-)
-@pytest.mark.parametrize(
- ("values", "expected_address"),
- [
- (
- {},
- [
- "address line 1",
- "address line 2",
- "address line 3",
- "address line 4",
- "address line 5",
- "address line 6",
- "address line 7",
- ],
- ),
- (
- {
- "address line 1": "123 Fake Street",
- "address line 6": "United Kingdom",
- },
- [
- "123 Fake Street",
- "address line 2",
- "address line 3",
- "address line 4",
- "address line 5",
- "United Kingdom",
- "address line 7",
- ],
- ),
- (
- {
- "address line 1": "123 Fake Street",
- "address line 2": "City of Town",
- "postcode": "SW1A 1AA",
- },
- [
- "123 Fake Street",
- "City of Town",
- "SW1A 1AA",
- ],
- ),
- ],
-)
-@pytest.mark.parametrize(
- ("contact_block", "expected_rendered_contact_block"),
- [
- (None, ""),
- ("", ""),
- (
- """
- The Pension Service
- Mail Handling Site A
- Wolverhampton WV9 1LU
+# @freeze_time("2012-12-12 12:12:12")
+# @mock.patch("notifications_utils.template.LetterPreviewTemplate.jinja_template.render")
+# @mock.patch("notifications_utils.template.unlink_govuk_escaped")
+# @mock.patch(
+# "notifications_utils.template.notify_letter_preview_markdown", return_value="Bar"
+# )
+# @pytest.mark.parametrize(
+# ("values", "expected_address"),
+# [
+# (
+# {},
+# [
+# "address line 1",
+# "address line 2",
+# "address line 3",
+# "address line 4",
+# "address line 5",
+# "address line 6",
+# "address line 7",
+# ],
+# ),
+# (
+# {
+# "address line 1": "123 Fake Street",
+# "address line 6": "United Kingdom",
+# },
+# [
+# "123 Fake Street",
+# "address line 2",
+# "address line 3",
+# "address line 4",
+# "address line 5",
+# "United Kingdom",
+# "address line 7",
+# ],
+# ),
+# (
+# {
+# "address line 1": "123 Fake Street",
+# "address line 2": "City of Town",
+# "postcode": "SW1A 1AA",
+# },
+# [
+# "123 Fake Street",
+# "City of Town",
+# "SW1A 1AA",
+# ],
+# ),
+# ],
+# )
+# @pytest.mark.parametrize(
+# ("contact_block", "expected_rendered_contact_block"),
+# [
+# (None, ""),
+# ("", ""),
+# (
+# """
+# The Pension Service
+# Mail Handling Site A
+# Wolverhampton WV9 1LU
- Telephone: 0845 300 0168
- Email: fpc.customercare@dwp.gsi.gov.uk
- Monday - Friday 8am - 6pm
- www.gov.uk
- """,
- (
- "The Pension Service
"
- "Mail Handling Site A
"
- "Wolverhampton WV9 1LU
"
- "
"
- "Telephone: 0845 300 0168
"
- "Email: fpc.customercare@dwp.gsi.gov.uk
"
- "Monday - Friday 8am - 6pm
"
- "www.gov.uk"
- ),
- ),
- ],
-)
-@pytest.mark.parametrize(
- ("extra_args", "expected_logo_file_name", "expected_logo_class"),
- [
- ({}, None, None),
- ({"logo_file_name": "example.foo"}, "example.foo", "foo"),
- ],
-)
-@pytest.mark.parametrize(
- ("additional_extra_args", "expected_date"),
- [
- ({}, "12 December 2012"),
- ({"date": None}, "12 December 2012"),
- # ({'date': datetime.date.fromtimestamp(0)}, '1 January 1970'),
- ],
-)
-def test_letter_preview_renderer(
- letter_markdown,
- unlink_govuk,
- jinja_template,
- values,
- expected_address,
- contact_block,
- expected_rendered_contact_block,
- extra_args,
- expected_logo_file_name,
- expected_logo_class,
- additional_extra_args,
- expected_date,
-):
- extra_args.update(additional_extra_args)
- str(
- LetterPreviewTemplate(
- {"content": "Foo", "subject": "Subject", "template_type": "letter"},
- values,
- contact_block=contact_block,
- **extra_args,
- )
- )
- jinja_template.assert_called_once_with(
- {
- "address": expected_address,
- "subject": "Subject",
- "message": "Bar",
- "date": expected_date,
- "contact_block": expected_rendered_contact_block,
- "admin_base_url": "http://localhost:6012",
- "logo_file_name": expected_logo_file_name,
- "logo_class": expected_logo_class,
- }
- )
- letter_markdown.assert_called_once_with(Markup("Foo\n"))
- unlink_govuk.assert_not_called()
+# Telephone: 0845 300 0168
+# Email: fpc.customercare@dwp.gsi.gov.uk
+# Monday - Friday 8am - 6pm
+# www.gov.uk
+# """,
+# (
+# "The Pension Service
"
+# "Mail Handling Site A
"
+# "Wolverhampton WV9 1LU
"
+# "
"
+# "Telephone: 0845 300 0168
"
+# "Email: fpc.customercare@dwp.gsi.gov.uk
"
+# "Monday - Friday 8am - 6pm
"
+# "www.gov.uk"
+# ),
+# ),
+# ],
+# )
+# @pytest.mark.parametrize(
+# ("extra_args", "expected_logo_file_name", "expected_logo_class"),
+# [
+# ({}, None, None),
+# ({"logo_file_name": "example.foo"}, "example.foo", "foo"),
+# ],
+# )
+# @pytest.mark.parametrize(
+# ("additional_extra_args", "expected_date"),
+# [
+# ({}, "12 December 2012"),
+# ({"date": None}, "12 December 2012"),
+# # ({'date': datetime.date.fromtimestamp(0)}, '1 January 1970'),
+# ],
+# )
+# def test_letter_preview_renderer(
+# letter_markdown,
+# unlink_govuk,
+# jinja_template,
+# values,
+# expected_address,
+# contact_block,
+# expected_rendered_contact_block,
+# extra_args,
+# expected_logo_file_name,
+# expected_logo_class,
+# additional_extra_args,
+# expected_date,
+# ):
+# extra_args.update(additional_extra_args)
+# str(
+# LetterPreviewTemplate(
+# {"content": "Foo", "subject": "Subject", "template_type": "letter"},
+# values,
+# contact_block=contact_block,
+# **extra_args,
+# )
+# )
+# jinja_template.assert_called_once_with(
+# {
+# "address": expected_address,
+# "subject": "Subject",
+# "message": "Bar",
+# "date": expected_date,
+# "contact_block": expected_rendered_contact_block,
+# "admin_base_url": "http://localhost:6012",
+# "logo_file_name": expected_logo_file_name,
+# "logo_class": expected_logo_class,
+# }
+# )
+# letter_markdown.assert_called_once_with(Markup("Foo\n"))
+# unlink_govuk.assert_not_called()
-@freeze_time("2001-01-01 12:00:00.000000")
-@mock.patch("notifications_utils.template.LetterPreviewTemplate.jinja_template.render")
-def test_letter_preview_renderer_without_mocks(jinja_template):
- str(
- LetterPreviewTemplate(
- {"content": "Foo", "subject": "Subject", "template_type": "letter"},
- {"addressline1": "name", "addressline2": "street", "postcode": "SW1 1AA"},
- contact_block="",
- )
- )
+# @freeze_time("2001-01-01 12:00:00.000000")
+# @mock.patch("notifications_utils.template.LetterPreviewTemplate.jinja_template.render")
+# def test_letter_preview_renderer_without_mocks(jinja_template):
+# str(
+# LetterPreviewTemplate(
+# {"content": "Foo", "subject": "Subject", "template_type": "letter"},
+# {"addressline1": "name", "addressline2": "street", "postcode": "SW1 1AA"},
+# contact_block="",
+# )
+# )
- jinja_template_locals = jinja_template.call_args_list[0][0][0]
+# jinja_template_locals = jinja_template.call_args_list[0][0][0]
- assert jinja_template_locals["address"] == [
- "name",
- "street",
- "SW1 1AA",
- ]
- assert jinja_template_locals["subject"] == "Subject"
- assert jinja_template_locals["message"] == "
Foo
" - assert jinja_template_locals["date"] == "1 January 2001" - assert jinja_template_locals["contact_block"] == "" - assert jinja_template_locals["admin_base_url"] == "http://localhost:6012" - assert jinja_template_locals["logo_file_name"] is None +# assert jinja_template_locals["address"] == [ +# "name", +# "street", +# "SW1 1AA", +# ] +# assert jinja_template_locals["subject"] == "Subject" +# assert jinja_template_locals["message"] == "Foo
" +# assert jinja_template_locals["date"] == "1 January 2001" +# assert jinja_template_locals["contact_block"] == "" +# assert jinja_template_locals["admin_base_url"] == "http://localhost:6012" +# assert jinja_template_locals["logo_file_name"] is None -@freeze_time("2012-12-12 12:12:12") -@mock.patch("notifications_utils.template.LetterImageTemplate.jinja_template.render") -@pytest.mark.parametrize( - ("page_count", "expected_oversized", "expected_page_numbers"), - [ - ( - 1, - False, - [1], - ), - ( - 5, - False, - [1, 2, 3, 4, 5], - ), - ( - 10, - False, - [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], - ), - ( - 11, - True, - [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], - ), - ( - 99, - True, - [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], - ), - ], -) -@pytest.mark.parametrize( - ( - "postage_args", - "expected_show_postage", - "expected_postage_class_value", - "expected_postage_description", - ), - [ - pytest.param({}, False, None, None), - pytest.param({"postage": None}, False, None, None), - pytest.param({"postage": "first"}, True, "letter-postage-first", "first class"), - pytest.param( - {"postage": "second"}, True, "letter-postage-second", "second class" - ), - pytest.param( - {"postage": "europe"}, True, "letter-postage-international", "international" - ), - pytest.param( - {"postage": "rest-of-world"}, - True, - "letter-postage-international", - "international", - ), - pytest.param( - {"postage": "third"}, - True, - "letter-postage-third", - "third class", - marks=pytest.mark.xfail(raises=TypeError), - ), - ], -) -def test_letter_image_renderer( - jinja_template, - page_count, - expected_page_numbers, - expected_oversized, - postage_args, - expected_show_postage, - expected_postage_class_value, - expected_postage_description, -): - str( - LetterImageTemplate( - {"content": "Content", "subject": "Subject", "template_type": "letter"}, - image_url="http://example.com/endpoint.png", - page_count=page_count, - contact_block="10 Downing Street", - **postage_args, - ) - ) - jinja_template.assert_called_once_with( - { - "image_url": "http://example.com/endpoint.png", - "page_numbers": expected_page_numbers, - "address": [ - "address line 1", - "address line 2", - "address line 3", - "address line 4", - "address line 5", - "address line 6", - "address line 7", - ], - "contact_block": "10 Downing Street", - "date": "12 December 2012", - "subject": "Subject", - "message": "Content
", - "show_postage": expected_show_postage, - "postage_class_value": expected_postage_class_value, - "postage_description": expected_postage_description, - } - ) +# @freeze_time("2012-12-12 12:12:12") +# @mock.patch("notifications_utils.template.LetterImageTemplate.jinja_template.render") +# @pytest.mark.parametrize( +# ("page_count", "expected_oversized", "expected_page_numbers"), +# [ +# ( +# 1, +# False, +# [1], +# ), +# ( +# 5, +# False, +# [1, 2, 3, 4, 5], +# ), +# ( +# 10, +# False, +# [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], +# ), +# ( +# 11, +# True, +# [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], +# ), +# ( +# 99, +# True, +# [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], +# ), +# ], +# ) +# @pytest.mark.parametrize( +# ( +# "postage_args", +# "expected_show_postage", +# "expected_postage_class_value", +# "expected_postage_description", +# ), +# [ +# pytest.param({}, False, None, None), +# pytest.param({"postage": None}, False, None, None), +# pytest.param({"postage": "first"}, True, "letter-postage-first", "first class"), +# pytest.param( +# {"postage": "second"}, True, "letter-postage-second", "second class" +# ), +# pytest.param( +# {"postage": "europe"}, True, "letter-postage-international", "international" +# ), +# pytest.param( +# {"postage": "rest-of-world"}, +# True, +# "letter-postage-international", +# "international", +# ), +# pytest.param( +# {"postage": "third"}, +# True, +# "letter-postage-third", +# "third class", +# marks=pytest.mark.xfail(raises=TypeError), +# ), +# ], +# ) +# def test_letter_image_renderer( +# jinja_template, +# page_count, +# expected_page_numbers, +# expected_oversized, +# postage_args, +# expected_show_postage, +# expected_postage_class_value, +# expected_postage_description, +# ): +# str( +# LetterImageTemplate( +# {"content": "Content", "subject": "Subject", "template_type": "letter"}, +# image_url="http://example.com/endpoint.png", +# page_count=page_count, +# contact_block="10 Downing Street", +# **postage_args, +# ) +# ) +# jinja_template.assert_called_once_with( +# { +# "image_url": "http://example.com/endpoint.png", +# "page_numbers": expected_page_numbers, +# "address": [ +# "address line 1", +# "address line 2", +# "address line 3", +# "address line 4", +# "address line 5", +# "address line 6", +# "address line 7", +# ], +# "contact_block": "10 Downing Street", +# "date": "12 December 2012", +# "subject": "Subject", +# "message": "Content
", +# "show_postage": expected_show_postage, +# "postage_class_value": expected_postage_class_value, +# "postage_description": expected_postage_description, +# } +# ) -@freeze_time("2012-12-12 12:12:12") -@mock.patch("notifications_utils.template.LetterImageTemplate.jinja_template.render") -@pytest.mark.parametrize( - "postage_argument", - [ - None, - "first", - "second", - "europe", - "rest-of-world", - ], -) -def test_letter_image_renderer_shows_international_post( - jinja_template, - postage_argument, -): - str( - LetterImageTemplate( - {"content": "Content", "subject": "Subject", "template_type": "letter"}, - { - "address line 1": "123 Example Street", - "address line 2": "Lima", - "address line 3": "Peru", - }, - image_url="http://example.com/endpoint.png", - page_count=1, - postage=postage_argument, - ) - ) - assert jinja_template.call_args_list[0][0][0]["postage_description"] == ( - "international" - ) +# @freeze_time("2012-12-12 12:12:12") +# @mock.patch("notifications_utils.template.LetterImageTemplate.jinja_template.render") +# @pytest.mark.parametrize( +# "postage_argument", +# [ +# None, +# "first", +# "second", +# "europe", +# "rest-of-world", +# ], +# ) +# def test_letter_image_renderer_shows_international_post( +# jinja_template, +# postage_argument, +# ): +# str( +# LetterImageTemplate( +# {"content": "Content", "subject": "Subject", "template_type": "letter"}, +# { +# "address line 1": "123 Example Street", +# "address line 2": "Lima", +# "address line 3": "Peru", +# }, +# image_url="http://example.com/endpoint.png", +# page_count=1, +# postage=postage_argument, +# ) +# ) +# assert jinja_template.call_args_list[0][0][0]["postage_description"] == ( +# "international" +# ) -def test_letter_image_template_renders_visually_hidden_address(): - template = BeautifulSoup( - str( - LetterImageTemplate( - {"content": "", "subject": "", "template_type": "letter"}, - { - "address_line_1": "line 1", - "address_line_2": "line 2", - "postcode": "postcode", - }, - image_url="http://example.com/endpoint.png", - page_count=1, - ) - ), - features="html.parser", - ) - assert str(template.select_one(".govuk-visually-hidden ul")) == ( - "