Move service permission handle inside the model

These helper functions for modifying a service permission were just
floating around loose in the view code.

A much better home for them is on the model. This will also make it
easy to reuse them in other views if we ever need to.
This commit is contained in:
Chris Hill-Scott
2018-11-05 16:53:03 +00:00
parent a69551b2cb
commit 318f846630
3 changed files with 40 additions and 45 deletions

View File

@@ -1170,7 +1170,10 @@ def test_enabling_and_disabling_email_and_sms(
mock_get_inbound_number_for_service
):
service_one['permissions'] = permissions_before_switch
mocked_fn = mocker.patch('app.service_api_client.update_service_with_properties', return_value=service_one)
mocked_fn = mocker.patch(
'app.notify_client.service_api_client.service_api_client.update_service',
return_value=service_one,
)
response = logged_in_platform_admin_client.get(
url_for('main.service_switch_can_send_{}'.format(notification_type), service_id=service_one['id'])
@@ -1178,7 +1181,7 @@ def test_enabling_and_disabling_email_and_sms(
assert response.status_code == 302
assert response.location == url_for('main.service_settings', service_id=service_one['id'], _external=True)
assert mocked_fn.call_args == call(service_one['id'], {'permissions': permissions_after_switch})
assert mocked_fn.call_args == call(service_one['id'], permissions=permissions_after_switch)
def test_and_more_hint_appears_on_settings_with_more_than_just_a_single_sender(