more test fixes, one test remaining

This commit is contained in:
stvnrlly
2022-11-28 13:51:37 -05:00
parent 9689aaf89b
commit 77c0faf4e5
13 changed files with 26 additions and 381 deletions

View File

@@ -277,69 +277,6 @@ def test_email_branding_preview(
assert mock_get_email_branding.called is email_branding_retrieved
@pytest.mark.parametrize('branding_style, filename', [
('hm-government', 'hm-government'),
(None, 'no-branding'),
(FieldWithNoneOption.NONE_OPTION_VALUE, 'no-branding')
])
def test_letter_template_preview_links_to_the_correct_image(
client_request,
mocker,
mock_get_letter_branding_by_id,
branding_style,
filename,
):
page = client_request.get(
'main.letter_template',
_test_page_title=False,
# Letter HTML doesnt use the Design System, so elements wont have class attributes
_test_for_elements_without_class=False,
branding_style=branding_style
)
image_link = page.find('img')['src']
assert image_link == url_for(
'no_cookie.letter_branding_preview_image',
filename=filename,
page=1
)
def test_letter_template_preview_headers(
client_request,
mock_get_letter_branding_by_id,
):
response = client_request.get_response(
'main.letter_template', branding_style='hm-government'
)
assert response.headers.get('X-Frame-Options') == 'SAMEORIGIN'
def test_letter_spec_redirect(client_request):
client_request.get(
'main.letter_spec',
_expected_status=302,
_expected_redirect=(
'https://docs.notifications.service.gov.uk'
'/documentation/images/notify-pdf-letter-spec-v2.4.pdf'
),
)
def test_letter_spec_redirect_with_non_logged_in_user(client_request):
client_request.logout()
client_request.get(
'main.letter_spec',
_expected_status=302,
_expected_redirect=(
'https://docs.notifications.service.gov.uk'
'/documentation/images/notify-pdf-letter-spec-v2.4.pdf'
),
)
def test_font_preload(
client_request,
mock_get_service_and_organisation_counts,