add new letter job statuses to job api client

add test to test_dashboard to confirm we're getting for the right queus
This commit is contained in:
Leo Hemsted
2017-04-07 11:08:40 +01:00
parent c509d3d24f
commit 2bb0cba430
2 changed files with 30 additions and 1 deletions

View File

@@ -12,6 +12,8 @@ class JobApiClient(NotifyAdminAPIClient):
'finished',
'cancelled',
'sending limits exceeded',
'ready to send',
'sent to dvla'
}
def __init__(self):

View File

@@ -1,7 +1,8 @@
from functools import partial
import copy
from flask import url_for
from unittest.mock import call, ANY
from flask import url_for
import pytest
from bs4 import BeautifulSoup
from freezegun import freeze_time
@@ -13,6 +14,7 @@ from app.main.views.dashboard import (
aggregate_status_types,
format_template_stats_to_list,
get_tuples_of_financial_years,
get_dashboard_partials
)
from tests import validate_route_permission
@@ -631,3 +633,28 @@ def test_get_tuples_of_financial_years_defaults_to_2015():
lambda year: 'http://example.com?year={}'.format(year),
end=2040,
))[0]
@freeze_time("2016-01-01 11:09:00.061258")
def test_should_show_all_jobs_with_valid_statuses(
logged_in_client,
mock_get_template_statistics,
mock_get_detailed_service,
mock_get_jobs,
mock_get_usage,
):
get_dashboard_partials(service_id=SERVICE_ONE_ID)
first_call = mock_get_jobs.call_args_list[0]
# first call - scheduled jobs only
assert first_call == call(ANY, statuses=['scheduled'])
# second call - everything but scheduled and cancelled
second_call = mock_get_jobs.call_args_list[1]
assert second_call == call(ANY, limit_days=ANY, statuses={
'pending',
'in progress',
'finished',
'sending limits exceeded',
'ready to send',
'sent to dvla'
})