mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 16:24:08 -04:00
Merge pull request #3235 from alphagov/job-page-for-expired-jobs
Customise the job page for jobs whose notifications have been purged
This commit is contained in:
@@ -294,7 +294,63 @@ def test_should_show_job_in_progress(
|
||||
service_id=service_one['id'],
|
||||
job_id=fake_uuid,
|
||||
)
|
||||
assert page.find('p', {'class': 'hint'}).text.strip() == 'Report is 50% complete…'
|
||||
assert [
|
||||
normalize_spaces(link.text)
|
||||
for link in page.select('.pill a')
|
||||
] == [
|
||||
'10 sending', '0 delivered', '0 failed'
|
||||
]
|
||||
assert page.select_one('p.hint').text.strip() == 'Report is 50% complete…'
|
||||
|
||||
|
||||
def test_should_show_job_without_notifications(
|
||||
client_request,
|
||||
service_one,
|
||||
active_user_with_permissions,
|
||||
mock_get_service_template,
|
||||
mock_get_job_in_progress,
|
||||
mocker,
|
||||
mock_get_notifications_with_no_notifications,
|
||||
mock_get_service_data_retention,
|
||||
fake_uuid,
|
||||
):
|
||||
page = client_request.get(
|
||||
'main.view_job',
|
||||
service_id=service_one['id'],
|
||||
job_id=fake_uuid,
|
||||
)
|
||||
assert [
|
||||
normalize_spaces(link.text)
|
||||
for link in page.select('.pill a')
|
||||
] == [
|
||||
'10 sending', '0 delivered', '0 failed'
|
||||
]
|
||||
assert page.select_one('p.hint').text.strip() == 'Report is 50% complete…'
|
||||
assert page.select_one('tbody').text.strip() == 'No messages to show yet…'
|
||||
|
||||
|
||||
def test_should_show_old_job(
|
||||
client_request,
|
||||
service_one,
|
||||
active_user_with_permissions,
|
||||
mock_get_service_template,
|
||||
mock_get_job,
|
||||
mocker,
|
||||
mock_get_notifications_with_no_notifications,
|
||||
mock_get_service_data_retention,
|
||||
fake_uuid,
|
||||
):
|
||||
page = client_request.get(
|
||||
'main.view_job',
|
||||
service_id=service_one['id'],
|
||||
job_id=fake_uuid,
|
||||
)
|
||||
assert not page.select('.pill a')
|
||||
assert not page.select('p.hint')
|
||||
assert not page.select('a[download]')
|
||||
assert page.select_one('tbody').text.strip() == (
|
||||
'These messages have been deleted because they were sent more than 7 days ago'
|
||||
)
|
||||
|
||||
|
||||
@freeze_time("2016-01-01 11:09:00.061258")
|
||||
|
||||
@@ -1818,7 +1818,8 @@ def mock_get_job_in_progress(mocker, api_user_active):
|
||||
return {"data": job_json(
|
||||
service_id, api_user_active, job_id=job_id,
|
||||
notification_count=10,
|
||||
notifications_requested=5
|
||||
notifications_requested=5,
|
||||
job_status='processing',
|
||||
)}
|
||||
|
||||
return mocker.patch('app.job_api_client.get_job', side_effect=_get_job)
|
||||
|
||||
Reference in New Issue
Block a user