mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 21:49:37 -04:00
Make sure create job client can handle statistics
The create job endpoint returns the data about the job with a `data:` wrapper. This commit makes sure that, when the client is trying to process a job which has just been created, it looks inside the `data` wrapper.
This commit is contained in:
@@ -20,9 +20,17 @@ def test_client_creates_job_data_correctly(mocker, fake_uuid):
|
||||
expected_url = '/service/{}/job'.format(service_id)
|
||||
|
||||
client = JobApiClient()
|
||||
mock_post = mocker.patch('app.notify_client.job_api_client.JobApiClient.post')
|
||||
mock_post = mocker.patch(
|
||||
'app.notify_client.job_api_client.JobApiClient.post',
|
||||
return_value={'data': dict(statistics=[], **expected_data)}
|
||||
)
|
||||
|
||||
client.create_job(job_id, service_id, template_id, original_file_name, notification_count)
|
||||
result = client.create_job(job_id, service_id, template_id, original_file_name, notification_count)
|
||||
|
||||
assert result['data']['notifications_requested'] == 0
|
||||
assert result['data']['notifications_sent'] == 0
|
||||
assert result['data']['notification_count'] == 1
|
||||
assert result['data']['notifications_failed'] == 0
|
||||
|
||||
mock_post.assert_called_once_with(url=expected_url, data=expected_data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user