Don’t load the check page if a job exists already

If a user clicks ‘back’ once they’ve sent a job we don’t want them to
land on the ‘check’ page again. This would suggest that they can send
the same job again (they can’t because that `job_id` is in the database
already). That said, it’s confusing to see that page; the natural thing
is to go jump back another step, to where you uploaded the file.
This commit is contained in:
Chris Hill-Scott
2018-04-30 12:55:56 +01:00
parent b44074bf3a
commit 054f75a8ed
2 changed files with 38 additions and 0 deletions

View File

@@ -2819,3 +2819,26 @@ def test_sms_sender_is_previewed(
assert sms_sender_on_page.text.strip() == 'From: GOVUK'
else:
assert not sms_sender_on_page
def test_redirects_to_template_if_job_exists_already(
client_request,
mock_get_service_email_template,
mock_get_job,
fake_uuid,
):
client_request.get(
'main.check_messages',
service_id=SERVICE_ONE_ID,
template_id=fake_uuid,
upload_id=fake_uuid,
original_file_name='example.csv',
_expected_status=301,
_expected_redirect=url_for(
'main.send_messages',
service_id=SERVICE_ONE_ID,
template_id=fake_uuid,
_external=True,
)
)