Only direct people to choosing a logo if they don’t have one

Once they have their logo set up people don’t typically need to change
it so we shouldn’t distract them with a button.
This commit is contained in:
Chris Hill-Scott
2019-01-23 10:17:36 +00:00
parent 77aba35c49
commit 9bf92b2054
2 changed files with 43 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
from datetime import datetime
from functools import partial
from unittest.mock import ANY, Mock
import pytest
@@ -430,6 +431,45 @@ def test_user_with_only_send_and_view_sees_letter_page(
assert page.select_one('h1').text.strip() == 'Two week reminder'
@pytest.mark.parametrize('letter_branding, expected_link, expected_link_text', (
(
None,
partial(url_for, 'main.request_letter_branding', from_template=TEMPLATE_ONE_ID),
'Add logo',
),
(
TEMPLATE_ONE_ID,
partial(url_for, 'main.edit_template_postage', template_id=TEMPLATE_ONE_ID),
'Change',
),
))
def test_letter_with_default_branding_has_add_logo_button(
mocker,
fake_uuid,
client_request,
service_one,
mock_get_template_folders,
mock_get_service_letter_template,
single_letter_contact_block,
letter_branding,
expected_link,
expected_link_text,
):
mocker.patch('app.main.views.templates.get_page_count_for_letter', return_value=1)
service_one['permissions'] += ['letter']
service_one['letter_branding'] = letter_branding
page = client_request.get(
'main.view_template',
service_id=SERVICE_ONE_ID,
template_id=TEMPLATE_ONE_ID,
)
first_edit_link = page.select_one('.template-container a')
assert first_edit_link['href'] == expected_link(service_id=SERVICE_ONE_ID)
assert first_edit_link.text == expected_link_text
@pytest.mark.parametrize("template_postage,expected_result", [
("first", "Postage: first class"),
("second", "Postage: second class"),