Merge pull request #3251 from alphagov/job-model

Make models for individual jobs and collections of jobs
This commit is contained in:
Chris Hill-Scott
2020-01-16 15:52:21 +00:00
committed by GitHub
20 changed files with 385 additions and 304 deletions

View File

@@ -1732,12 +1732,16 @@ 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'}],
'scheduled_for': None,
'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'}],
'scheduled_for': None,
'job_status': 'finished',
'upload_type': 'letter'}
]
return {
@@ -1747,8 +1751,8 @@ def mock_get_uploads(mocker, api_user_active):
'next': 'services/{}/uploads?page={}'.format(service_id, page + 1)
}
}
return mocker.patch('app.job_api_client.get_uploads', side_effect=_get_uploads)
# Why is mocking on the model needed?
return mocker.patch('app.models.job.PaginatedUploads.client', side_effect=_get_uploads)
@pytest.fixture(scope='function')