Go straight to add if no contact blocks yet

Same as previous commit, but for going forward, not back.
This commit is contained in:
Chris Hill-Scott
2019-07-08 09:31:30 +01:00
parent 8e080d6079
commit fe7c3259c2
2 changed files with 20 additions and 8 deletions

View File

@@ -27,6 +27,7 @@ from tests.conftest import (
ElementNotFound,
active_caseworking_user,
active_user_view_permissions,
fake_uuid,
mock_get_service_email_template,
mock_get_service_letter_template,
mock_get_service_template,
@@ -687,17 +688,26 @@ def test_should_show_sms_template_with_downgraded_unicode_characters(
assert rendered_msg in page.text
@pytest.mark.parametrize('mock_contact_block, expected_partial_url', (
(no_letter_contact_blocks, partial(
url_for, 'main.service_add_letter_contact', from_template=fake_uuid(),
)),
(single_letter_contact_block, partial(
url_for, 'main.set_template_sender', template_id=fake_uuid(),
)),
))
def test_should_let_letter_contact_block_be_changed_for_the_template(
mocker,
mock_get_service_letter_template,
mock_get_template_folders,
no_letter_contact_blocks,
client_request,
service_one,
fake_uuid,
mock_contact_block,
expected_partial_url
):
service_one['permissions'].append('letter')
mocker.patch('app.main.views.templates.get_page_count_for_letter', return_value=1)
mock_contact_block(mocker)
page = client_request.get(
'main.view_template',
@@ -706,11 +716,9 @@ def test_should_let_letter_contact_block_be_changed_for_the_template(
_test_page_title=False,
)
assert page.find('a', {'class': 'edit-template-link-letter-contact'})['href'] == url_for(
'main.set_template_sender',
service_id=SERVICE_ONE_ID,
template_id=fake_uuid,
)
assert page.select_one(
'a.edit-template-link-letter-contact'
)['href'] == expected_partial_url(service_id=SERVICE_ONE_ID)
def test_should_show_page_template_with_priority_select_if_platform_admin(