mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-19 22:13:48 -04:00
Go back to template if coming from template
Most users don’t have multiple contact blocks. So by default it should feel like you’re just editing the one contact block, rather than managing a collection of them. So this page skips the ‘choose’ page when the user doesn’t yet have any contact blocks.
This commit is contained in:
@@ -2169,26 +2169,39 @@ def test_add_letter_contact_when_coming_from_template(
|
||||
fake_uuid,
|
||||
mock_get_service_letter_template,
|
||||
):
|
||||
data = {
|
||||
'letter_contact_block': "1 Example Street"
|
||||
}
|
||||
|
||||
page = client_request.post(
|
||||
page = client_request.get(
|
||||
'main.service_add_letter_contact',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
_data=data,
|
||||
from_template=fake_uuid,
|
||||
_follow_redirects=True
|
||||
)
|
||||
|
||||
assert page.select_one('.govuk-back-link')['href'] == url_for(
|
||||
'main.view_template',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
template_id=fake_uuid,
|
||||
)
|
||||
|
||||
client_request.post(
|
||||
'main.service_add_letter_contact',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
_data={
|
||||
'letter_contact_block': '1 Example Street',
|
||||
},
|
||||
from_template=fake_uuid,
|
||||
_expected_redirect=url_for(
|
||||
'main.view_template',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
template_id=fake_uuid,
|
||||
_external=True,
|
||||
),
|
||||
)
|
||||
|
||||
mock_add_letter_contact.assert_called_once_with(
|
||||
SERVICE_ONE_ID,
|
||||
contact_block="1 Example Street",
|
||||
is_default=True
|
||||
is_default=True,
|
||||
)
|
||||
|
||||
assert page.find('h1').text == 'Set letter contact block'
|
||||
|
||||
|
||||
@pytest.mark.parametrize('fixture, data, api_default_args', [
|
||||
(no_sms_senders, {}, True),
|
||||
|
||||
Reference in New Issue
Block a user