Merge pull request #1364 from alphagov/letter-job-page-real

Customise the job page to make sense for letters
This commit is contained in:
Chris Hill-Scott
2017-07-21 13:10:09 +01:00
committed by GitHub
9 changed files with 183 additions and 44 deletions

View File

@@ -158,6 +158,77 @@ def test_should_show_job_in_progress(
assert page.find('p', {'class': 'hint'}).text.strip() == 'Report is 50% complete…'
@freeze_time("2016-01-01 11:09:00.061258")
def test_should_show_letter_job(
client_request,
mock_get_service_letter_template,
mock_get_job,
mock_get_notifications,
fake_uuid,
):
page = client_request.get(
'main.view_job',
service_id=SERVICE_ONE_ID,
job_id=fake_uuid,
)
assert normalize_spaces(page.h1.text) == 'thisisatest.csv'
assert normalize_spaces(page.select('p.bottom-gutter')[0].text) == (
'Sent by Test User on 1 January at 11:09am'
)
assert page.select('.banner-default-with-tick') == []
assert normalize_spaces(page.select('tbody tr')[0].text) == (
'07123456789 template content'
)
assert normalize_spaces(page.select('.keyline-block')[0].text) == (
'1 Letter'
)
assert normalize_spaces(page.select('.keyline-block')[1].text) == (
'6 January Estimated delivery date'
)
assert page.select('[download=download]') == []
assert page.select('.hint') == []
mock_get_notifications.assert_called_with(
SERVICE_ONE_ID,
fake_uuid,
status=[
'created',
'pending',
'sending',
'delivered',
'sent',
'failed',
'temporary-failure',
'permanent-failure',
'technical-failure',
],
)
@freeze_time("2016-01-01 11:09:00.061258")
def test_should_show_letter_job_with_banner_after_sending(
client_request,
mock_get_service_letter_template,
mock_get_job,
mock_get_notifications,
fake_uuid,
):
page = client_request.get(
'main.view_job',
service_id=SERVICE_ONE_ID,
job_id=fake_uuid,
just_sent='yes',
)
assert page.select('p.bottom-gutter') == []
assert normalize_spaces(page.select('.banner-default-with-tick')[0].text) == (
'Weve started printing your letters'
)
@freeze_time("2016-01-01T00:00:00.061258")
def test_should_show_scheduled_job(
logged_in_client,

View File

@@ -1170,6 +1170,7 @@ def test_can_start_letters_job(
data={}
)
assert response.status_code == 302
assert 'just_sent=yes' in response.location
@pytest.mark.parametrize('filetype', ['pdf', 'png'])