Apply sender to template when adding

If you’ve come from a template to add a new letter sender then it’s
because you want those words on that template. This commit adds the
extra API call to make that happen.
This commit is contained in:
Chris Hill-Scott
2019-07-08 11:20:28 +01:00
parent 90f56353ab
commit 7fef51aa6a
3 changed files with 23 additions and 4 deletions

View File

@@ -2168,6 +2168,7 @@ def test_add_letter_contact_when_coming_from_template(
mock_add_letter_contact,
fake_uuid,
mock_get_service_letter_template,
mock_update_service_template_sender,
):
page = client_request.get(
'main.service_add_letter_contact',
@@ -2201,6 +2202,11 @@ def test_add_letter_contact_when_coming_from_template(
contact_block="1 Example Street",
is_default=True,
)
mock_update_service_template_sender.assert_called_once_with(
SERVICE_ONE_ID,
fake_uuid,
'1234',
)
@pytest.mark.parametrize('fixture, data, api_default_args', [

View File

@@ -270,7 +270,14 @@ def get_non_default_letter_contact_block(mocker):
@pytest.fixture(scope='function')
def mock_add_letter_contact(mocker):
def _add_letter_contact(service_id, contact_block, is_default=False):
return
return {'data': {
'id': '1234',
'service_id': service_id,
'contact_block': '1 Example Street',
'is_default': True,
'created_at': str(datetime.utcnow()),
'updated_at': None
}}
return mocker.patch('app.service_api_client.add_letter_contact', side_effect=_add_letter_contact)