POST to the correct endpoint when updating

`prefix_sms_with_service_name` is a computed attribute on the service
model. It’s where we get the value from, and the API does some work to
get it from the database, or derive it from the default SMS sender.
It can’t be updated, because it’s not itself a database column.

`prefix_sms` is the name of the actual database column. This is the
thing that we need to update.

This will go away eventually.
This commit is contained in:
Chris Hill-Scott
2017-11-06 15:08:34 +00:00
parent 31497945c0
commit 9e600b6051
3 changed files with 3 additions and 3 deletions

View File

@@ -502,7 +502,7 @@ def service_set_sms_prefix(service_id):
if form.validate_on_submit():
service_api_client.update_service(
current_service['id'],
prefix_sms_with_service_name=(form.enabled.data == 'on')
prefix_sms=(form.enabled.data == 'on')
)
return redirect(url_for('.service_settings', service_id=service_id))

View File

@@ -107,7 +107,7 @@ class ServiceAPIClient(NotifyAdminAPIClient):
'permissions',
'organisation_type',
'free_sms_fragment_limit',
'prefix_sms_with_service_name',
'prefix_sms',
}
if disallowed_attributes:
raise TypeError('Not allowed to update service attributes: {}'.format(

View File

@@ -2108,5 +2108,5 @@ def test_updates_sms_prefixing(
)
mock_update_service.assert_called_once_with(
service_id=SERVICE_ONE_ID,
prefix_sms_with_service_name=expected_api_argument,
prefix_sms=expected_api_argument,
)