diff --git a/app/main/views/send.py b/app/main/views/send.py index 4615491a9..c3a0fcb2f 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -312,3 +312,15 @@ def start_job(service_id, upload_id): return redirect( url_for('main.view_job', job_id=upload_id, service_id=service_id, help=request.form.get('help')) ) + + +@main.route("/services//end-tour/") +@login_required +@user_has_permissions('manage_templates') +def go_to_dashboard_after_tour(service_id, example_template_id): + + service_api_client.delete_service_template(service_id, example_template_id) + + return redirect( + url_for('main.service_dashboard', service_id=service_id) + ) diff --git a/app/templates/main_nav.html b/app/templates/main_nav.html index 733379e1d..1fdfb461c 100644 --- a/app/templates/main_nav.html +++ b/app/templates/main_nav.html @@ -2,14 +2,14 @@ {% if request.args['help'] and request.args['help'] != '0' %} {% call banner_wrapper(type='tour') %} -

Get started

+

Try this example

1.

- Send yourself this example message + Every message is sent from a template

@@ -29,14 +29,11 @@

- Now try it with your own message + Notify delivers the message

{% if request.args['help'] == '3' %} - - Write an email - - - Write a text message + + Now go to your dashboard {% endif %}
diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py index 753a205f5..4f3f431a3 100644 --- a/tests/app/main/views/test_send.py +++ b/tests/app/main/views/test_send.py @@ -696,3 +696,26 @@ def test_send_and_check_page_renders_if_no_statistics( page = BeautifulSoup(resp.data.decode('utf-8'), 'html.parser') assert page.h1.text.strip() == 'Check and confirm' mock_get_stats.assert_called_once_with(fake_uuid, today) + + +def test_go_to_dashboard_after_tour( + app_, + mocker, + api_user_active, + mock_login, + mock_get_service, + mock_has_permissions, + mock_delete_service_template, + fake_uuid +): + + with app_.test_request_context(), app_.test_client() as client: + client.login(api_user_active) + + resp = 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)