Pass service domain to api when adding a new service

We need to pass the domain to api when adding a service so that api can
link the domain of the service with a letter brand.
This commit is contained in:
Katie Smith
2019-02-12 14:02:21 +00:00
parent 1cb1ce310a
commit 31a1c1ca51
6 changed files with 21 additions and 12 deletions

View File

@@ -49,7 +49,8 @@ def test_should_add_service_and_redirect_to_tour_when_no_services(
message_limit=app_.config['DEFAULT_SERVICE_LIMIT'],
restricted=True,
user_id=api_user_active.id,
email_from='testing.the.post'
email_from='testing.the.post',
service_domain=None
)
mock_create_service_template.assert_called_once_with(
'Example text message template',
@@ -71,10 +72,10 @@ def test_should_add_service_and_redirect_to_tour_when_no_services(
mock_create_or_update_free_sms_fragment_limit.assert_called_once_with(101, 25000)
@pytest.mark.parametrize('organisation_type, free_allowance', [
('central', 250 * 1000),
('local', 25 * 1000),
('nhs', 25 * 1000),
@pytest.mark.parametrize('organisation_type, free_allowance, service_domain', [
('central', 250 * 1000, None),
('local', 25 * 1000, None),
('nhs', 25 * 1000, 'nhs.uk'),
])
def test_should_add_service_and_redirect_to_dashboard_when_existing_service(
app_,
@@ -86,6 +87,7 @@ def test_should_add_service_and_redirect_to_dashboard_when_existing_service(
api_user_active,
organisation_type,
free_allowance,
service_domain,
mock_create_or_update_free_sms_fragment_limit,
mock_get_all_email_branding,
):
@@ -103,7 +105,8 @@ def test_should_add_service_and_redirect_to_dashboard_when_existing_service(
message_limit=app_.config['DEFAULT_SERVICE_LIMIT'],
restricted=True,
user_id=api_user_active.id,
email_from='testing.the.post'
email_from='testing.the.post',
service_domain=service_domain
)
mock_create_or_update_free_sms_fragment_limit.assert_called_once_with(101, free_allowance)
assert len(mock_create_service_template.call_args_list) == 0

View File

@@ -74,6 +74,7 @@ def test_client_creates_service_with_correct_data(
True,
fake_uuid,
'test@example.com',
'nhs.uk'
)
mock_post.assert_called_once_with(
'/service',
@@ -89,6 +90,7 @@ def test_client_creates_service_with_correct_data(
restricted=True,
user_id=fake_uuid,
email_from='test@example.com',
service_domain='nhs.uk'
),
)

View File

@@ -249,7 +249,7 @@ def test_returns_value_from_cache(
(user_api_client, 'set_user_permissions', [user_id, SERVICE_ONE_ID, []], {}),
(user_api_client, 'activate_user', [api_user_pending(sample_uuid())], {}),
(service_api_client, 'remove_user_from_service', [SERVICE_ONE_ID, user_id], {}),
(service_api_client, 'create_service', ['', '', 0, False, user_id, sample_uuid()], {}),
(service_api_client, 'create_service', ['', '', 0, False, user_id, sample_uuid(), ''], {}),
(invite_api_client, 'accept_invite', [SERVICE_ONE_ID, user_id], {}),
])
def test_deletes_user_cache(