mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-01 12:19:47 -04:00
Incorporate breaking utils changes
Brings in: - [ ] https://github.com/alphagov/notifications-utils/pull/94
This commit is contained in:
@@ -3,21 +3,19 @@ from flask import url_for
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"query_args, params", [
|
||||
({}, {'govuk_banner': True}),
|
||||
({'govuk_banner': 'false'}, {'govuk_banner': False})
|
||||
"query_args, result", [
|
||||
({}, True),
|
||||
({'govuk_banner': 'false'}, 'false')
|
||||
]
|
||||
)
|
||||
def test_renders(app_, mocker, query_args, params):
|
||||
def test_renders(app_, mocker, query_args, result):
|
||||
with app_.test_request_context(), app_.test_client() as client:
|
||||
|
||||
mock_html_email = mocker.patch(
|
||||
'app.main.views.index.HTMLEmail',
|
||||
return_value=lambda x: 'rendered'
|
||||
)
|
||||
mock_convert_to_boolean = mocker.patch('app.main.views.index.convert_to_boolean')
|
||||
mocker.patch('app.main.views.index.HTMLEmailTemplate.__str__', return_value='rendered')
|
||||
|
||||
response = client.get(url_for('main.email_template', **query_args))
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.get_data(as_text=True) == 'rendered'
|
||||
mock_html_email.assert_called_once_with(**params)
|
||||
mock_convert_to_boolean.assert_called_once_with(result)
|
||||
|
||||
@@ -163,7 +163,7 @@ def test_should_show_scheduled_job(
|
||||
|
||||
assert response.status_code == 200
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
assert page.find('main').find_all('p')[2].text.strip() == 'Sending will start today at midnight'
|
||||
assert page.find('main').find_all('p')[1].text.strip() == 'Sending will start today at midnight'
|
||||
assert page.find('input', {'type': 'submit', 'value': 'Cancel sending'})
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ def test_should_show_page_for_one_template(
|
||||
('.view_letter_template_as_image', 'image/png'),
|
||||
]
|
||||
)
|
||||
@patch("app.main.views.templates.LetterPreview.__call__")
|
||||
@patch("app.main.views.templates.LetterPreviewTemplate")
|
||||
def test_should_show_preview_letter_templates(
|
||||
mock_letter_preview,
|
||||
view,
|
||||
@@ -56,7 +56,7 @@ def test_should_show_preview_letter_templates(
|
||||
api_user_active,
|
||||
mock_login,
|
||||
mock_get_service,
|
||||
mock_get_service_template,
|
||||
mock_get_service_email_template,
|
||||
mock_get_user,
|
||||
mock_get_user_by_email,
|
||||
mock_has_permissions,
|
||||
@@ -69,7 +69,7 @@ def test_should_show_preview_letter_templates(
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.content_type == expected_content_type
|
||||
mock_get_service_template.assert_called_with(service_id, template_id)
|
||||
mock_get_service_email_template.assert_called_with(service_id, template_id)
|
||||
assert mock_letter_preview.call_args[0][0]['content'] == "Your vehicle tax is about to expire"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user