mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
Only allow update service to modify named attrs
To prevent typos and inadvertently updating something we shouldn’t, this adds some filtering to the update_service method to make sure it is only allowed to update certain attributes of a service.
This commit is contained in:
@@ -37,3 +37,9 @@ def test_client_gets_service(mocker, function, params):
|
||||
|
||||
function(client, 'foo')
|
||||
mock_get.assert_called_once_with('/service/foo', params=params)
|
||||
|
||||
|
||||
def test_client_only_updates_allowed_attributes(mocker):
|
||||
with pytest.raises(TypeError) as error:
|
||||
ServiceAPIClient().update_service('service_id', foo='bar')
|
||||
assert str(error.value) == 'Not allowed to update service attributes: foo'
|
||||
|
||||
Reference in New Issue
Block a user