Merge pull request #3658 from alphagov/use-scheduled-job-stats

Use new API endpoint for scheduled job stats
This commit is contained in:
Chris Hill-Scott
2020-10-06 12:00:38 +01:00
committed by GitHub
7 changed files with 105 additions and 32 deletions

View File

@@ -1798,12 +1798,12 @@ def mock_get_letter_job_in_progress(mocker, api_user_active):
@pytest.fixture(scope='function')
def mock_has_jobs(mocker):
mocker.patch('app.job_api_client.has_jobs', return_value=True)
return mocker.patch('app.job_api_client.has_jobs', return_value=True)
@pytest.fixture(scope='function')
def mock_has_no_jobs(mocker):
mocker.patch('app.job_api_client.has_jobs', return_value=False)
return mocker.patch('app.job_api_client.has_jobs', return_value=False)
@pytest.fixture(scope='function')
@@ -1842,6 +1842,15 @@ def mock_get_jobs(mocker, api_user_active):
return mocker.patch('app.job_api_client.get_jobs', side_effect=_get_jobs)
@pytest.fixture(scope='function')
def mock_get_scheduled_job_stats(mocker, api_user_active):
return mocker.patch('app.job_api_client.get_scheduled_job_stats', return_value={
# These values match the return value of `mock_get_jobs`
'count': 2,
'soonest_scheduled_for': '2016-01-01 11:09:00'
})
@pytest.fixture(scope='function')
def mock_get_uploads(mocker, api_user_active):
def _get_uploads(service_id, limit_days=None, statuses=None, page=1):