Put data from job on job page

The main change is showing the finished time if the job is finished, rather
than the start time.
This commit is contained in:
Chris Hill-Scott
2016-03-02 16:15:15 +00:00
parent 3a3e4258ef
commit d9073862fa
6 changed files with 77 additions and 31 deletions

View File

@@ -109,6 +109,18 @@ def job_json():
'bucket_name': 'service-1-{}-notify'.format(job_id),
'file_name': '{}.csv'.format(job_id),
'created_at': created_at,
'notification_count': 1
'notification_count': 1,
'status': ''
}
return data
def notification_json():
import datetime
data = {
'notifications': [{
'sent_at': str(datetime.datetime.now().time())
} for i in range(5)],
'links': {}
}
return data

View File

@@ -30,7 +30,8 @@ def test_should_show_page_for_one_job(app_,
mock_get_service,
mock_get_service_template,
job_data,
mock_get_job):
mock_get_job,
mock_get_notifications):
service_id = job_data['service']
job_id = job_data['id']
file_name = job_data['original_file_name']

View File

@@ -10,6 +10,7 @@ from . import (
template_json,
api_key_json,
job_json,
notification_json,
invite_json
)
from app.notify_client.models import (
@@ -541,6 +542,16 @@ def mock_get_jobs(mocker):
return mocker.patch('app.job_api_client.get_job', side_effect=_get_jobs)
@pytest.fixture(scope='function')
def mock_get_notifications(mocker):
def _get_notifications(service_id, job_id):
return notification_json()
return mocker.patch(
'app.notification_api_client.get_notifications_for_service',
side_effect=_get_notifications
)
@pytest.fixture(scope='function')
def mock_has_permissions(mocker):
def _has_permission(permissions, service_id=None, or_=False):