mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-09 19:04:33 -04:00
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:
@@ -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))
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user