merge from main

This commit is contained in:
Kenneth Kehl
2024-06-14 12:50:15 -07:00
17 changed files with 213 additions and 153 deletions

View File

@@ -19,10 +19,9 @@ def test_non_logged_in_user_can_see_homepage(
"Reach people where they are with government-powered text messages"
)
assert page.select_one("a.usa-button.usa-button--big")["href"] == url_for(
"main.sign_in",
)
assert page.select_one(
"a.usa-button.login-button.login-button--primary.margin-right-2"
).text == "Sign in with \n"
assert page.select_one("meta[name=description]") is not None
# This area is hidden for the pilot
# assert normalize_spaces(page.select_one('#whos-using-notify').text) == (
@@ -179,26 +178,6 @@ def test_old_static_pages_redirect(client_request, view, expected_view):
)
def test_message_status_page_contains_message_status_ids(client_request):
# The 'email-statuses' and 'sms-statuses' id are linked to when we display a message status,
# so this test ensures we don't accidentally remove them
page = client_request.get("main.message_status")
# email-statuses is commented out in view
# assert page.find(id='email-statuses')
assert page.find(id="text-message-statuses")
def test_message_status_page_contains_link_to_support(client_request):
page = client_request.get("main.message_status")
sms_status_table = page.find(id="text-message-statuses").findNext("tbody")
temp_fail_details_cell = sms_status_table.select_one(
"tr:nth-child(4) > td:nth-child(2)"
)
assert temp_fail_details_cell.find("a").attrs["href"] == url_for("main.support")
def test_old_using_notify_page(client_request):
client_request.get("main.using_notify", _expected_status=410)

View File

@@ -3,7 +3,6 @@ import uuid
import pytest
from flask import url_for
from app.main.views.sign_in import _reformat_keystring
from app.models.user import User
from tests.conftest import SERVICE_ONE_ID, normalize_spaces
@@ -20,25 +19,12 @@ def test_render_sign_in_template_for_new_user(client_request):
# then these indices need to be 1 instead of 0.
# Currently it's not enabled for the test or production environments.
assert page.select("main a")[0].text == "Sign in with Login.gov"
assert page.select("main a")[1].text == "Create Login.gov account"
# TODO: We'll have to adjust this depending on whether Login.gov is
# enabled or not; fix this in the future.
assert "Sign in again" not in normalize_spaces(page.text)
def test_reformat_keystring():
orig = "-----BEGIN PRIVATE KEY----- blah blah blah -----END PRIVATE KEY-----"
expected = """-----BEGIN PRIVATE KEY-----
blah
blah
blah
-----END PRIVATE KEY-----
"""
reformatted = _reformat_keystring(orig)
assert reformatted == expected
def test_sign_in_explains_session_timeout(client_request):
client_request.logout()
page = client_request.get("main.sign_in", next="/foo")

View File

@@ -22,7 +22,7 @@ def test_landing_page(end_to_end_context):
"heading",
name="Reach people where they are with government-powered text messages",
)
sign_in_button = page.get_by_role("link", name="Sign in")
sign_in_button = page.get_by_role("link", name="Sign in with")
benefits_studio_email = page.get_by_role("link", name="tts-benefits-studio@gsa.gov")
# Check to make sure the elements are visible.
@@ -31,7 +31,8 @@ def test_landing_page(end_to_end_context):
expect(benefits_studio_email).to_be_visible()
# Check to make sure the sign-in button and email links are correct.
expect(sign_in_button).to_have_attribute("href", "/sign-in")
href_value = sign_in_button.get_attribute('href')
assert href_value is not None, "The sign-in button does not have an href attribute"
expect(benefits_studio_email).to_have_attribute(
"href", "mailto:tts-benefits-studio@gsa.gov"
)

View File

@@ -49,3 +49,13 @@ def test_base_json_formatter_contains_service_id():
== "message to log"
)
assert service_id_filter.filter(record).service_id == "no-service-id"
def test_scrub():
result = logging.scrub(
"This is a message with 17775554324, and also 18884449323 and also 17775554324"
)
assert (
result
== "This is a message with 1XXXXX54324, and also 1XXXXX49323 and also 1XXXXX54324"
)