Succesfully update service notes

This commit is contained in:
Pea Tyczynska
2021-01-15 15:38:39 +00:00
parent 6d7b16fd59
commit 341933478b
2 changed files with 20 additions and 1 deletions

View File

@@ -109,12 +109,12 @@ class ServiceAPIClient(NotifyAdminAPIClient):
'go_live_user',
'go_live_at',
'rate_limit',
'notes',
}
if disallowed_attributes:
raise TypeError('Not allowed to update service attributes: {}'.format(
", ".join(disallowed_attributes)
))
endpoint = "/service/{0}".format(service_id)
return self.post(endpoint, data)

View File

@@ -5260,3 +5260,22 @@ def test_view_edit_service_notes(
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
assert page.select_one('h1').text == "Edit service notes"
assert page.find('label', class_="form-label").text.strip() == "Notes"
def test_update_service_notes(
platform_admin_client,
service_one,
mock_update_service
):
response = platform_admin_client.post(
url_for(
'main.edit_service_notes',
service_id=SERVICE_ONE_ID,
),
data={'notes': "Very fluffy"}
)
assert response.status_code == 302
settings_url = url_for(
'main.service_settings', service_id=SERVICE_ONE_ID, _external=True)
assert settings_url == response.location
mock_update_service.assert_called_with(SERVICE_ONE_ID, notes="Very fluffy")