diff --git a/app/notify_client/notification_api_client.py b/app/notify_client/notification_api_client.py index 10f0d3e6f..dae4f5825 100644 --- a/app/notify_client/notification_api_client.py +++ b/app/notify_client/notification_api_client.py @@ -93,5 +93,10 @@ class NotificationApiClient(NotifyAdminAPIClient): return self.get(url=get_url) + def update_notification_to_cancelled(self, service_id, notification_id): + return self.post( + url='/service/{}/notifications/{}/cancel'.format(service_id, notification_id), + data={}) + notification_api_client = NotificationApiClient() diff --git a/tests/app/notify_client/test_notification_client.py b/tests/app/notify_client/test_notification_client.py index aeb051994..6486741e3 100644 --- a/tests/app/notify_client/test_notification_client.py +++ b/tests/app/notify_client/test_notification_client.py @@ -85,3 +85,12 @@ def test_get_api_notifications_changes_letter_statuses(mocker): assert ret['notifications'][0]['status'] == 'created' assert ret['notifications'][1]['status'] == 'created' assert ret['notifications'][2]['status'] == 'accepted' + + +def test_update_notification_to_cancelled(mocker): + mock_post = mocker.patch('app.notify_client.notification_api_client.NotificationApiClient.post') + NotificationApiClient().update_notification_to_cancelled('foo', 'bar') + mock_post.assert_called_once_with( + url='/service/foo/notifications/bar/cancel', + data={}, + )