Move end of tour route into tour.py

In https://github.com/alphagov/notifications-admin/pull/3663/files we
made specific routes for sending the ‘tour’ text message, rather than
sharing the ‘one-off’ routes in `send.py`.

This commit moves the final route in the tour journey into `tour.py` as
well, which is where I expected to find it when I was looking for it
just now.
This commit is contained in:
Chris Hill-Scott
2021-10-06 12:32:00 +01:00
parent 1c68e4bb43
commit 1cc087b8de
4 changed files with 52 additions and 52 deletions

View File

@@ -3058,46 +3058,6 @@ def test_check_messages_back_link(
) == expected_url(service_id=SERVICE_ONE_ID, template_id=fake_uuid)
def test_shows_link_to_end_tour(
client_request,
mock_get_notification,
fake_uuid,
):
page = client_request.get(
'main.view_notification',
service_id=SERVICE_ONE_ID,
notification_id=fake_uuid,
help=3,
)
assert page.select(".banner-tour a")[0]['href'] == url_for(
'main.go_to_dashboard_after_tour',
service_id=SERVICE_ONE_ID,
example_template_id='5407f4db-51c7-4150-8758-35412d42186a',
)
def test_go_to_dashboard_after_tour_link(
logged_in_client,
mocker,
api_user_active,
mock_login,
mock_get_service,
mock_has_permissions,
mock_delete_service_template,
fake_uuid
):
resp = logged_in_client.get(
url_for('main.go_to_dashboard_after_tour', service_id=fake_uuid, example_template_id=fake_uuid)
)
assert resp.status_code == 302
assert resp.location == url_for("main.service_dashboard", service_id=fake_uuid, _external=True)
mock_delete_service_template.assert_called_once_with(fake_uuid, fake_uuid)
@pytest.mark.parametrize('num_requested,expected_msg', [
(None, 'example.csv contains 1,234 phone numbers.'),
("0", 'example.csv contains 1,234 phone numbers.'),

View File

@@ -616,3 +616,43 @@ def test_check_tour_notification_redirects_to_first_step_if_not_all_placeholders
_external=True
),
)
def test_shows_link_to_end_tour(
client_request,
mock_get_notification,
fake_uuid,
):
page = client_request.get(
'main.view_notification',
service_id=SERVICE_ONE_ID,
notification_id=fake_uuid,
help=3,
)
assert page.select(".banner-tour a")[0]['href'] == url_for(
'main.go_to_dashboard_after_tour',
service_id=SERVICE_ONE_ID,
example_template_id='5407f4db-51c7-4150-8758-35412d42186a',
)
def test_go_to_dashboard_after_tour_link(
logged_in_client,
mocker,
api_user_active,
mock_login,
mock_get_service,
mock_has_permissions,
mock_delete_service_template,
fake_uuid
):
resp = logged_in_client.get(
url_for('main.go_to_dashboard_after_tour', service_id=fake_uuid, example_template_id=fake_uuid)
)
assert resp.status_code == 302
assert resp.location == url_for("main.service_dashboard", service_id=fake_uuid, _external=True)
mock_delete_service_template.assert_called_once_with(fake_uuid, fake_uuid)