diff --git a/app/main/views/dashboard.py b/app/main/views/dashboard.py index a60ded48a..eb0b85aea 100644 --- a/app/main/views/dashboard.py +++ b/app/main/views/dashboard.py @@ -6,7 +6,7 @@ from app.main import main from ._jobs import jobs -@main.route("//dashboard") +@main.route("/services//dashboard") @login_required def dashboard(service_id): return render_template( diff --git a/app/main/views/index.py b/app/main/views/index.py index bde2d1d17..0dba1e396 100644 --- a/app/main/views/index.py +++ b/app/main/views/index.py @@ -20,25 +20,25 @@ def verifymobile(): return render_template('views/verify-mobile.html') -@main.route("//send-email") +@main.route("/services//send-email") @login_required def sendemail(service_id): return render_template('views/send-email.html') -@main.route("//check-email") +@main.route("/services//check-email") @login_required def checkemail(service_id): return render_template('views/check-email.html') -@main.route("//manage-users") +@main.route("/services//manage-users") @login_required def manageusers(service_id): return render_template('views/manage-users.html', service_id=service_id) -@main.route("//api-keys") +@main.route("/services//api-keys") @login_required def apikeys(service_id): return render_template('views/api-keys.html', service_id=service_id) diff --git a/app/main/views/jobs.py b/app/main/views/jobs.py index f2e807e98..29755f3e1 100644 --- a/app/main/views/jobs.py +++ b/app/main/views/jobs.py @@ -42,7 +42,7 @@ messages = [ ] -@main.route("//jobs") +@main.route("/services//jobs") @login_required def showjobs(service_id): return render_template( @@ -52,7 +52,7 @@ def showjobs(service_id): ) -@main.route("//jobs/") +@main.route("/services//jobs/") @login_required def showjob(service_id, job_id): return render_template( @@ -76,7 +76,7 @@ def showjob(service_id, job_id): ) -@main.route("//jobs//notification/") +@main.route("/services//jobs//notification/") @login_required def shownotification(service_id, job_id, notification_id): return render_template( diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index 8021265ad..92bd302c9 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -11,7 +11,7 @@ service = { } -@main.route("//service-settings") +@main.route("/services//service-settings") @login_required def service_settings(service_id): return render_template( @@ -21,7 +21,7 @@ def service_settings(service_id): ) -@main.route("//service-settings/name", methods=['GET', 'POST']) +@main.route("/services//service-settings/name", methods=['GET', 'POST']) @login_required def name(service_id): @@ -39,7 +39,7 @@ def name(service_id): return redirect(url_for('.confirm_name_change', service_id=service_id)) -@main.route("//service-settings/name/confirm", methods=['GET', 'POST']) +@main.route("/services//service-settings/name/confirm", methods=['GET', 'POST']) @login_required def confirm_name_change(service_id): @@ -56,7 +56,7 @@ def confirm_name_change(service_id): return redirect(url_for('.service_settings', service_id=service_id)) -@main.route("//service-settings/request-to-go-live", methods=['GET', 'POST']) +@main.route("/services//service-settings/request-to-go-live", methods=['GET', 'POST']) @login_required def request_to_go_live(service_id): if request.method == 'GET': @@ -69,7 +69,7 @@ def request_to_go_live(service_id): return redirect(url_for('.service_settings', service_id=service_id)) -@main.route("//service-settings/status", methods=['GET', 'POST']) +@main.route("/services//service-settings/status", methods=['GET', 'POST']) @login_required def status(service_id): if request.method == 'GET': @@ -82,7 +82,7 @@ def status(service_id): return redirect(url_for('.confirm_status_change', service_id=service_id)) -@main.route("//service-settings/status/confirm", methods=['GET', 'POST']) +@main.route("/services//service-settings/status/confirm", methods=['GET', 'POST']) @login_required def confirm_status_change(service_id): @@ -100,7 +100,7 @@ def confirm_status_change(service_id): return redirect(url_for('.service_settings', service_id=service_id)) -@main.route("//service-settings/delete", methods=['GET', 'POST']) +@main.route("/services//service-settings/delete", methods=['GET', 'POST']) @login_required def delete(service_id): if request.method == 'GET': @@ -113,7 +113,7 @@ def delete(service_id): return redirect(url_for('.confirm_delete', service_id=service_id)) -@main.route("//service-settings/delete/confirm", methods=['GET', 'POST']) +@main.route("/services//service-settings/delete/confirm", methods=['GET', 'POST']) @login_required def confirm_delete(service_id): diff --git a/app/main/views/sms.py b/app/main/views/sms.py index 48d730684..0ef985558 100644 --- a/app/main/views/sms.py +++ b/app/main/views/sms.py @@ -35,7 +35,7 @@ message_templates = [ ] -@main.route("//sms/send", methods=['GET', 'POST']) +@main.route("/services//sms/send", methods=['GET', 'POST']) @login_required def sendsms(service_id): form = CsvUploadForm() @@ -65,7 +65,7 @@ def sendsms(service_id): service_id=service_id) -@main.route("//sms/check", methods=['GET', 'POST']) +@main.route("/services//sms/check", methods=['GET', 'POST']) @login_required def checksms(service_id): if request.method == 'GET': diff --git a/app/main/views/templates.py b/app/main/views/templates.py index 4c876dfb9..b638d69fe 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -5,7 +5,7 @@ from app.main import main from app.main.forms import TemplateForm -@main.route("//templates") +@main.route("/services//templates") @login_required def manage_templates(service_id): return render_template( @@ -14,7 +14,7 @@ def manage_templates(service_id): ) -@main.route("//templates/template", methods=['GET', 'POST']) +@main.route("/services//templates/template", methods=['GET', 'POST']) @login_required def add_template(service_id): @@ -34,7 +34,7 @@ def add_template(service_id): return redirect(url_for('.manage_templates', service_id=service_id)) -@main.route("//templates/template/add", methods=['GET', 'POST']) +@main.route("/services//templates/template/add", methods=['GET', 'POST']) @login_required def edit_template(service_id): diff --git a/tests/app/main/views/test_add_service.py b/tests/app/main/views/test_add_service.py index 13bba97ad..a84d5da2a 100644 --- a/tests/app/main/views/test_add_service.py +++ b/tests/app/main/views/test_add_service.py @@ -23,7 +23,7 @@ def test_should_add_service_and_redirect_to_next_page(notifications_admin, notif client.post('/two-factor', data={'sms_code': '12345'}) response = client.post('/add-service', data={'service_name': 'testing the post'}) assert response.status_code == 302 - assert response.location == 'http://localhost/123/dashboard' + assert response.location == 'http://localhost/services/123/dashboard' saved_service = services_dao.find_service_by_service_name('testing the post') assert saved_service is not None diff --git a/tests/app/main/views/test_dashboard.py b/tests/app/main/views/test_dashboard.py index 386a733dd..89f4385de 100644 --- a/tests/app/main/views/test_dashboard.py +++ b/tests/app/main/views/test_dashboard.py @@ -9,7 +9,7 @@ def test_should_show_recent_jobs_on_dashboard(notifications_admin, with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.get('/123/dashboard') + response = client.get('/services/123/dashboard') assert response.status_code == 200 assert 'Test message 1' in response.get_data(as_text=True) diff --git a/tests/app/main/views/test_jobs.py b/tests/app/main/views/test_jobs.py index 259ae8649..cb03cf7ee 100644 --- a/tests/app/main/views/test_jobs.py +++ b/tests/app/main/views/test_jobs.py @@ -6,7 +6,7 @@ def test_should_return_list_of_all_jobs(notifications_admin, notifications_admin with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.get('/123/jobs') + response = client.get('/services/123/jobs') assert response.status_code == 200 assert 'Test message 1' in response.get_data(as_text=True) @@ -18,7 +18,7 @@ def test_should_show_page_for_one_job(notifications_admin, notifications_admin_d with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.get('/123/jobs/456') + response = client.get('/services/123/jobs/456') assert response.status_code == 200 assert 'dispatch_20151114.csv' in response.get_data(as_text=True) @@ -30,7 +30,7 @@ def test_should_show_page_for_one_notification(notifications_admin, notification with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.get('/123/jobs/456/notification/3') + response = client.get('/services/123/jobs/456/notification/3') assert response.status_code == 200 assert 'Text message' in response.get_data(as_text=True) diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py index 43868f871..5ee50b29a 100644 --- a/tests/app/main/views/test_service_settings.py +++ b/tests/app/main/views/test_service_settings.py @@ -6,7 +6,7 @@ def test_should_show_overview(notifications_admin, notifications_admin_db, notif with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.get('/123/service-settings') + response = client.get('/services/123/service-settings') assert response.status_code == 200 assert 'Service settings' in response.get_data(as_text=True) @@ -16,7 +16,7 @@ def test_should_show_service_name(notifications_admin, notifications_admin_db, n with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.get('/123/service-settings/name') + response = client.get('/services/123/service-settings/name') assert response.status_code == 200 assert 'Change your service name' in response.get_data(as_text=True) @@ -26,10 +26,10 @@ def test_should_redirect_after_change_service_name(notifications_admin, notifica with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.post('/123/service-settings/request-to-go-live') + response = client.post('/services/123/service-settings/request-to-go-live') assert response.status_code == 302 - assert 'http://localhost/123/service-settings' == response.location + assert 'http://localhost/services/123/service-settings' == response.location def test_should_show_service_name_confirmation(notifications_admin, notifications_admin_db, notify_db_session): @@ -37,7 +37,7 @@ def test_should_show_service_name_confirmation(notifications_admin, notification with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.get('/123/service-settings/name/confirm') + response = client.get('/services/123/service-settings/name/confirm') assert response.status_code == 200 assert 'Change your service name' in response.get_data(as_text=True) @@ -49,10 +49,10 @@ def test_should_redirect_after_service_name_confirmation(notifications_admin, no with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.post('/123/service-settings/name/confirm') + response = client.post('/services/123/service-settings/name/confirm') assert response.status_code == 302 - assert 'http://localhost/123/service-settings' == response.location + assert 'http://localhost/services/123/service-settings' == response.location def test_should_show_request_to_go_live(notifications_admin, notifications_admin_db, notify_db_session): @@ -60,7 +60,7 @@ def test_should_show_request_to_go_live(notifications_admin, notifications_admin with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.get('/123/service-settings/request-to-go-live') + response = client.get('/services/123/service-settings/request-to-go-live') assert response.status_code == 200 assert 'Request to go live' in response.get_data(as_text=True) @@ -71,10 +71,10 @@ def test_should_redirect_after_request_to_go_live(notifications_admin, notificat with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.post('/123/service-settings/request-to-go-live') + response = client.post('/services/123/service-settings/request-to-go-live') assert response.status_code == 302 - assert 'http://localhost/123/service-settings' == response.location + assert 'http://localhost/services/123/service-settings' == response.location def test_should_show_status_page(notifications_admin, notifications_admin_db, notify_db_session): @@ -82,7 +82,7 @@ def test_should_show_status_page(notifications_admin, notifications_admin_db, no with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.get('/123/service-settings/status') + response = client.get('/services/123/service-settings/status') assert response.status_code == 200 assert 'Turn off all outgoing notifications' in response.get_data(as_text=True) @@ -93,10 +93,10 @@ def test_should_show_redirect_after_status_change(notifications_admin, notificat with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.post('/123/service-settings/status') + response = client.post('/services/123/service-settings/status') assert response.status_code == 302 - assert 'http://localhost/123/service-settings/status/confirm' == response.location + assert 'http://localhost/services/123/service-settings/status/confirm' == response.location def test_should_show_status_confirmation(notifications_admin, notifications_admin_db, notify_db_session): @@ -104,7 +104,7 @@ def test_should_show_status_confirmation(notifications_admin, notifications_admi with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.get('/123/service-settings/status/confirm') + response = client.get('/services/123/service-settings/status/confirm') assert response.status_code == 200 assert 'Turn off all outgoing notifications' in response.get_data(as_text=True) @@ -115,10 +115,10 @@ def test_should_redirect_after_status_confirmation(notifications_admin, notifica with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.post('/123/service-settings/status/confirm') + response = client.post('/services/123/service-settings/status/confirm') assert response.status_code == 302 - assert 'http://localhost/123/service-settings' == response.location + assert 'http://localhost/services/123/service-settings' == response.location def test_should_show_delete_page(notifications_admin, notifications_admin_db, notify_db_session): @@ -126,7 +126,7 @@ def test_should_show_delete_page(notifications_admin, notifications_admin_db, no with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.get('/123/service-settings/delete') + response = client.get('/services/123/service-settings/delete') assert response.status_code == 200 assert 'Delete this service from Notify' in response.get_data(as_text=True) @@ -137,10 +137,10 @@ def test_should_show_redirect_after_deleting_service(notifications_admin, notifi with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.post('/123/service-settings/delete') + response = client.post('/services/123/service-settings/delete') assert response.status_code == 302 - assert 'http://localhost/123/service-settings/delete/confirm' == response.location + assert 'http://localhost/services/123/service-settings/delete/confirm' == response.location def test_should_show_delete_confirmation(notifications_admin, notifications_admin_db, notify_db_session): @@ -148,7 +148,7 @@ def test_should_show_delete_confirmation(notifications_admin, notifications_admi with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.get('/123/service-settings/delete/confirm') + response = client.get('/services/123/service-settings/delete/confirm') assert response.status_code == 200 assert 'Delete this service from Notify' in response.get_data(as_text=True) @@ -159,7 +159,7 @@ def test_should_redirect_delete_confirmation(notifications_admin, notifications_ with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.post('/123/service-settings/delete/confirm') + response = client.post('/services/123/service-settings/delete/confirm') assert response.status_code == 302 - assert 'http://localhost/123/dashboard' == response.location + assert 'http://localhost/services/123/dashboard' == response.location diff --git a/tests/app/main/views/test_sign_out.py b/tests/app/main/views/test_sign_out.py index 8a34eec0d..f4ca543be 100644 --- a/tests/app/main/views/test_sign_out.py +++ b/tests/app/main/views/test_sign_out.py @@ -34,7 +34,7 @@ def test_sign_out_user(notifications_admin, with notifications_admin.test_client() as client: client.login(user) # Check we are logged in - response = client.get('/123/dashboard') + response = client.get('/services/123/dashboard') assert response.status_code == 200 response = client.get(url_for('main.sign_out')) assert response.status_code == 302 diff --git a/tests/app/main/views/test_sms.py b/tests/app/main/views/test_sms.py index b14a15187..c74356f5f 100644 --- a/tests/app/main/views/test_sms.py +++ b/tests/app/main/views/test_sms.py @@ -9,7 +9,7 @@ def test_upload_empty_csvfile_returns_to_upload_page(notifications_admin, notifi client.login(user) upload_data = {'file': (BytesIO(''.encode('utf-8')), 'emtpy.csv')} - response = client.post('/123/sms/send', data=upload_data, + response = client.post('/services/123/sms/send', data=upload_data, follow_redirects=True) assert response.status_code == 200 @@ -27,7 +27,7 @@ def test_upload_csvfile_with_invalid_phone_shows_check_page_with_errors( file_contents = 'phone\n+44 123\n+44 456'.encode('utf-8') upload_data = {'file': (BytesIO(file_contents), 'invalid.csv')} - response = client.post('/123/sms/send', data=upload_data, + response = client.post('/services/123/sms/send', data=upload_data, follow_redirects=True) assert response.status_code == 200 content = response.get_data(as_text=True) @@ -48,7 +48,7 @@ def test_upload_csvfile_with_valid_phone_shows_first3_and_last3_numbers( file_contents = 'phone\n+44 7700 900981\n+44 7700 900982\n+44 7700 900983\n+44 7700 900984\n+44 7700 900985\n+44 7700 900986\n+44 7700 900987\n+44 7700 900988\n+44 7700 900989'.encode('utf-8') # noqa upload_data = {'file': (BytesIO(file_contents), 'valid.csv')} - response = client.post('/123/sms/send', data=upload_data, + response = client.post('/services/123/sms/send', data=upload_data, follow_redirects=True) content = response.get_data(as_text=True) @@ -79,7 +79,7 @@ def test_upload_csvfile_with_valid_phone_shows_all_if_6_or_less_numbers( file_contents = 'phone\n+44 7700 900981\n+44 7700 900982\n+44 7700 900983\n+44 7700 900984\n+44 7700 900985\n+44 7700 900986'.encode('utf-8') # noqa upload_data = {'file': (BytesIO(file_contents), 'valid.csv')} - response = client.post('/123/sms/send', data=upload_data, + response = client.post('/services/123/sms/send', data=upload_data, follow_redirects=True) content = response.get_data(as_text=True) @@ -102,7 +102,7 @@ def test_should_redirect_to_job(notifications_admin, notifications_admin_db, user = create_test_user('active') client.login(user) - response = client.post('/123/sms/check') + response = client.post('/services/123/sms/check') assert response.status_code == 302 - assert response.location == 'http://localhost/123/jobs/456' + assert response.location == 'http://localhost/services/123/jobs/456' diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index 669b05a0d..03e5ec963 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -6,7 +6,7 @@ def test_should_return_list_of_all_templates(notifications_admin, notifications_ with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.get('/123/templates') + response = client.get('/services/123/templates') assert response.status_code == 200 @@ -16,7 +16,7 @@ def test_should_show_page_for_one_templates(notifications_admin, notifications_a with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.get('/123/templates/template') + response = client.get('/services/123/templates/template') assert response.status_code == 200 @@ -26,7 +26,7 @@ def test_should_redirect_when_saving_a_template(notifications_admin, notificatio with notifications_admin.test_client() as client: user = create_test_user('active') client.login(user) - response = client.post('/123/templates/template') + response = client.post('/services/123/templates/template') assert response.status_code == 302 - assert response.location == 'http://localhost/123/templates' + assert response.location == 'http://localhost/services/123/templates'