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:
Chris Hill-Scott
2016-08-31 13:20:42 +01:00
parent 0967706aed
commit be90cf2783
2 changed files with 12 additions and 3 deletions

View File

@@ -71,9 +71,10 @@ class JobApiClient(BaseAPIClient):
job = self.post(url='/service/{}/job'.format(service_id), data=data)
if 'notifications_sent' not in job['data']:
stats = self.__convert_statistics(job)
stats = self.__convert_statistics(job['data'])
job['data']['notifications_sent'] = stats['delivered'] + stats['failed']
job['data']['notifications_delivered'] = stats['delivered']
job['data']['notifications_failed'] = stats['failed']
job['data']['notifications_requested'] = stats['requested']
return job