Add a cancel job button

If you schedule a job you might change your mind or circumstances might
change. So you need to be able to cancel it. This commit adds a button
on the job page which hits the `…/cancel` API endpoint for a job.
This commit is contained in:
Chris Hill-Scott
2016-09-01 15:40:49 +01:00
parent c94675f457
commit eb11615a32
5 changed files with 68 additions and 1 deletions

View File

@@ -361,3 +361,15 @@ def test_client_parses_empty_job_stats_for_service(mocker):
assert result['data'][1]['notifications_sent'] == 0
assert result['data'][1]['notification_count'] == 40
assert result['data'][1]['notifications_failed'] == 0
def test_cancel_job(mocker):
mock_post = mocker.patch('app.notify_client.job_api_client.JobApiClient.post')
JobApiClient().cancel_job('service_id', 'job_id')
mock_post.assert_called_once_with(
url='/service/{}/job/{}/cancel'.format('service_id', 'job_id'),
data={}
)