From 7775508c9747f2c03a6b8ac313ec35fffba192e3 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Mon, 21 Oct 2024 10:27:35 -0700 Subject: [PATCH] fixed testing --- app/main/views/index.py | 4 ++- .../views/guidance/benchmark-performance.html | 4 +-- app/templates/views/guidance/clear-goals.html | 4 +-- .../views/guidance/establish-trust.html | 2 +- .../views/guidance/multiple-languages.html | 4 +-- .../views/guidance/rules-and-regulations.html | 2 +- .../views/guidance/write-for-action.html | 4 +-- tests/app/main/views/test_index.py | 28 ++++++++++++++++++- 8 files changed, 40 insertions(+), 12 deletions(-) diff --git a/app/main/views/index.py b/app/main/views/index.py index 7ead8b647..7745e053b 100644 --- a/app/main/views/index.py +++ b/app/main/views/index.py @@ -24,7 +24,9 @@ from app.main.views.sub_navigation_dictionaries import ( from app.utils.user import user_is_logged_in from notifications_utils.url_safe_token import generate_token -feature_guidance_enabled = os.getenv('FEATURE_GUIDANCE_ENABLED', 'false').lower() == 'true' +feature_guidance_enabled = ( + os.getenv("FEATURE_GUIDANCE_ENABLED", "false").lower() == "true" +) # Hook to check for guidance routes diff --git a/app/templates/views/guidance/benchmark-performance.html b/app/templates/views/guidance/benchmark-performance.html index aaaa2af9b..195e3471a 100644 --- a/app/templates/views/guidance/benchmark-performance.html +++ b/app/templates/views/guidance/benchmark-performance.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% set page_title = "Benchmark performance" %} +{% set page_title = "Measuring performance with benchmarking" %} {% block per_page_title %} {{page_title}} @@ -9,7 +9,7 @@ {% block content_column_content %} {% with title=page_title %}{% include "components/guidance/nav_breadcrumb.html" %}{% endwith %}
-

Measuring performance with benchmarking

+

{{page_title}}

Learn how effective your texting program can be.

diff --git a/app/templates/views/guidance/clear-goals.html b/app/templates/views/guidance/clear-goals.html index 01fba51de..03144015d 100644 --- a/app/templates/views/guidance/clear-goals.html +++ b/app/templates/views/guidance/clear-goals.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% set page_title = "Clear goals" %} +{% set page_title = "Establish clear goals" %} {% block per_page_title %} {{page_title}} @@ -9,7 +9,7 @@ {% block content_column_content %} {% with title=page_title %}{% include "components/guidance/nav_breadcrumb.html" %}{% endwith %}

-

Establish clear goals

+

{{page_title}}

Start with a singular purpose. Make explicit what you want to achieve.

Text messaging should be one part of how you communicate with the people you serve, and it is best used to provoke action or influence behavior. Therefore, when starting to plan your texting campaign, it’s important to start with diff --git a/app/templates/views/guidance/establish-trust.html b/app/templates/views/guidance/establish-trust.html index fc12d02a4..ceb40bc73 100644 --- a/app/templates/views/guidance/establish-trust.html +++ b/app/templates/views/guidance/establish-trust.html @@ -10,7 +10,7 @@ {% block content_column_content %} {% with title=page_title %}{% include "components/guidance/nav_breadcrumb.html" %}{% endwith %}

-

Establish Trust

+

{{page_title}}

Help your audience anticipate and welcome your texts.

People are wary of texts they’re not expecting to receive. Before you send your first text, consider how you will diff --git a/app/templates/views/guidance/multiple-languages.html b/app/templates/views/guidance/multiple-languages.html index 79dce8ea8..947f9fbbe 100644 --- a/app/templates/views/guidance/multiple-languages.html +++ b/app/templates/views/guidance/multiple-languages.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% set page_title = "Multiple languages" %} +{% set page_title = "Text in multiple languages" %} {% block per_page_title %} {{page_title}} @@ -9,7 +9,7 @@ {% block content_column_content %} {% with title=page_title %}{% include "components/guidance/nav_breadcrumb.html" %}{% endwith %}

-

Text in multiple languages

+

{{page_title}}

What to know as you plan translated texts.

diff --git a/app/templates/views/guidance/rules-and-regulations.html b/app/templates/views/guidance/rules-and-regulations.html index 2c2f6ab0b..dc13bd853 100644 --- a/app/templates/views/guidance/rules-and-regulations.html +++ b/app/templates/views/guidance/rules-and-regulations.html @@ -9,7 +9,7 @@ {% block content_column_content %} {% with title=page_title %}{% include "components/guidance/nav_breadcrumb.html" %}{% endwith %}

-

Follow rules & regulations

+

{{page_title}}

Understand what is required when texting the public.

What to know about consent and opting out

diff --git a/app/templates/views/guidance/write-for-action.html b/app/templates/views/guidance/write-for-action.html index d5587654b..16dbc545f 100644 --- a/app/templates/views/guidance/write-for-action.html +++ b/app/templates/views/guidance/write-for-action.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% from "components/guidance/circle_number.html" import circle_number %} -{% set page_title = "Write for action" %} +{% set page_title = "Write texts that provoke action" %} {% block per_page_title %} {{page_title}} @@ -10,7 +10,7 @@ {% block content_column_content %} {% with title=page_title %}{% include "components/guidance/nav_breadcrumb.html" %}{% endwith %}

-

Write texts that provoke action

+

{{page_title}}

Help your audience know what to do with the information you send.

diff --git a/tests/app/main/views/test_index.py b/tests/app/main/views/test_index.py index a4d57a89c..4f9ab48b9 100644 --- a/tests/app/main/views/test_index.py +++ b/tests/app/main/views/test_index.py @@ -52,7 +52,10 @@ def test_logged_in_user_redirects_to_choose_account( client_request.get( "main.sign_in", _expected_status=302, - _expected_redirect=url_for("main.show_accounts_or_dashboard"), + _expected_redirect=url_for( + "main.show_accounts_or_dashboard", + next="EMAIL_IS_OK", + ), ) @@ -91,6 +94,7 @@ def test_hiding_pages_from_search_engines( "roadmap", "features", "documentation", + "guidance", "security", "message_status", "features_sms", @@ -127,6 +131,28 @@ def test_static_pages(client_request, mock_get_organization_by_domain, view, moc ) +@pytest.mark.parametrize( + "endpoint, template", + [ + ("main.guidance", "views/guidance/guidance.html"), + ("main.clear_goals", "views/guidance/clear-goals.html"), + ("main.rules_and_regulations", "views/guidance/rules-and-regulations.html"), + ("main.establish_trust", "views/guidance/establish-trust.html"), + ("main.write_for_action", "views/guidance/write-for-action.html"), + ("main.multiple_languages", "views/guidance/multiple-languages.html"), + ("main.benchmark_performance", "views/guidance/benchmark-performance.html"), + ] +) +def test_guidance_routes(client_request, endpoint, template): + # Make the request to the endpoint + page = client_request.get(endpoint) + + # Assert that the page loads successfully (HTTP 200 OK) + assert page.status_code == 200 + + + + def test_guidance_pages_link_to_service_pages_when_signed_in(client_request, mocker): mocker.patch("app.notify_client.user_api_client.UserApiClient.deactivate_user")