fixed testing

This commit is contained in:
Beverly Nguyen
2024-10-21 10:27:35 -07:00
parent 088c2244a3
commit 7775508c97
8 changed files with 40 additions and 12 deletions

View File

@@ -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

View File

@@ -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 %}
<section class="usa-prose">
<h1>Measuring performance with benchmarking</h1>
<h1>{{page_title}}</h1>
<p class="font-sans-lg text-base">Learn how effective your texting program can be.</p>
<p>

View File

@@ -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 %}
<section class="usa-prose">
<h1>Establish clear goals</h1>
<h1>{{page_title}}</h1>
<p class="font-sans-lg text-base">Start with a singular purpose. Make explicit what you want to achieve.</p>
<p>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, its important to start with

View File

@@ -10,7 +10,7 @@
{% block content_column_content %}
{% with title=page_title %}{% include "components/guidance/nav_breadcrumb.html" %}{% endwith %}
<section class="usa-prose">
<h1>Establish Trust</h1>
<h1>{{page_title}}</h1>
<p class="font-sans-lg text-base">Help your audience anticipate and welcome your texts.</p>
<p>
People are wary of texts theyre not expecting to receive. Before you send your first text, consider how you will

View File

@@ -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 %}
<section class="usa-prose">
<h1>Text in multiple languages</h1>
<h1>{{page_title}}</h1>
<p class="font-sans-lg text-base"> What to know as you plan translated texts.</p>
<p>

View File

@@ -9,7 +9,7 @@
{% block content_column_content %}
{% with title=page_title %}{% include "components/guidance/nav_breadcrumb.html" %}{% endwith %}
<section class="usa-prose">
<h1>Follow rules & regulations</h1>
<h1>{{page_title}}</h1>
<p class="font-sans-lg text-base">Understand what is required when texting the public.</p>
<h2>What to know about consent and opting out</h2>
<p>

View File

@@ -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 %}
<section class="usa-prose">
<h1>Write texts that provoke action</h1>
<h1>{{page_title}}</h1>
<p class="font-sans-lg text-base"> Help your audience know what to do with the information you send.</p>
<p>

View File

@@ -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")