mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
Don’t assume jobs status will be present
The API response for jobs includes a field called `job_status`. The API response for uploads doesn’t. The `Job` mode handles uploads and jobs, so it needs to account for the possibility of the field not being there.
This commit is contained in:
@@ -34,7 +34,7 @@ class Job(JSONModel):
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
return self.job_status
|
||||
return self._dict.get('job_status')
|
||||
|
||||
@property
|
||||
def cancelled(self):
|
||||
|
||||
@@ -1732,14 +1732,12 @@ def mock_get_uploads(mocker, api_user_active):
|
||||
'notification_count': 10,
|
||||
'created_at': '2016-01-01 11:09:00.061258',
|
||||
'statistics': [{'count': 8, 'status': 'delivered'}, {'count': 2, 'status': 'temporary-failure'}],
|
||||
'job_status': 'finished',
|
||||
'upload_type': 'job'},
|
||||
{'id': 'job_id_1',
|
||||
'original_file_name': 'some.csv',
|
||||
'notification_count': 1,
|
||||
'created_at': '2016-01-01 11:09:00.061258',
|
||||
'statistics': [{'count': 1, 'status': 'delivered'}],
|
||||
'job_status': 'finished',
|
||||
'upload_type': 'letter'}
|
||||
]
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user