mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
Merge branch 'main' of https://github.com/GSA/notifications-admin into 2515-remove-autofocus-js
This commit is contained in:
@@ -20,14 +20,14 @@ def test_owasp_useful_headers_set(
|
||||
assert search(
|
||||
r"script-src 'self' static\.example\.com 'unsafe-eval' https:\/\/js-agent\.new"
|
||||
r"relic\.com https:\/\/gov-bam\.nr-data\.net https:\/\/www\.googletagmanager\."
|
||||
r"com https:\/\/www\.google-analytics\."
|
||||
r"com https:\/\/dap\.digitalgov\."
|
||||
r"gov 'nonce-.*';",
|
||||
r"com https:\/\/www\.google-analytics\.com https:\/\/dap\.digitalgov\.gov "
|
||||
r"https:\/\/cdn\.socket\.io",
|
||||
csp,
|
||||
)
|
||||
assert search(r"'nonce-[^']+';", csp)
|
||||
assert search(
|
||||
r"connect-src 'self' https:\/\/gov-bam.nr-data\.net https:\/\/www\.google-analytics\."
|
||||
r"com;",
|
||||
r"connect-src 'self' https:\/\/gov-bam\.nr-data\.net https:\/\/www\.google-analytics\."
|
||||
r"com http:\/\/localhost:6011 ws:\/\/localhost:6011;",
|
||||
csp,
|
||||
)
|
||||
assert search(r"style-src 'self' static\.example\.com 'nonce-.*';", csp)
|
||||
|
||||
@@ -16,16 +16,22 @@ def test_non_logged_in_user_can_see_homepage(
|
||||
client_request.logout()
|
||||
page = client_request.get("main.index", _test_page_title=False)
|
||||
|
||||
assert page.h1.text.strip() == (
|
||||
"Reach people where they are with government-powered text messages"
|
||||
)
|
||||
heading = page.h1.text.strip()
|
||||
assert heading in [
|
||||
"Reach people where they are with government-powered text messages",
|
||||
"There's currently a technical issue.",
|
||||
]
|
||||
|
||||
# Assert the entire HTML of the button to include the image
|
||||
button = page.select_one(
|
||||
"a.usa-button.login-button.login-button--primary.margin-right-2"
|
||||
)
|
||||
assert "Sign in with" in button.text.strip() # Assert button text
|
||||
assert button.find("img")["alt"] == "Login.gov logo" # Assert image presence
|
||||
|
||||
if heading == "There's currently a technical issue.":
|
||||
assert button is None
|
||||
else:
|
||||
assert button is not None
|
||||
assert "Sign in with" in button.text.strip()
|
||||
assert button.find("img")["alt"] == "Login.gov logo"
|
||||
|
||||
assert page.select_one("meta[name=description]") is not None
|
||||
assert page.select_one("#whos-using-notify a") is None
|
||||
|
||||
@@ -945,7 +945,7 @@ def test_load_edit_template_with_copy_of_template(
|
||||
assert page.select_one("form")["method"] == "post"
|
||||
|
||||
assert page.select_one("input")["value"] == (expected_name)
|
||||
assert page.select_one("textarea").text == ("\r\nYour ((thing)) is due soon")
|
||||
assert page.select_one("textarea").text.strip() == ("Your ((thing)) is due soon")
|
||||
mock_get_service_email_template.assert_called_once_with(
|
||||
SERVICE_TWO_ID,
|
||||
TEMPLATE_ONE_ID,
|
||||
|
||||
@@ -164,12 +164,12 @@ def test_should_show_empty_text_box(
|
||||
)
|
||||
|
||||
textbox = page.select_one(
|
||||
"[data-module=autofocus][data-force-focus=True] .usa-input"
|
||||
".usa-input"
|
||||
)
|
||||
assert "value" not in textbox
|
||||
assert textbox["name"] == "placeholder_value"
|
||||
assert textbox["class"] == [
|
||||
"usa-input",
|
||||
"form-control", "usa-input",
|
||||
]
|
||||
# data-module=autofocus is set on a containing element so it
|
||||
# shouldn’t also be set on the textbox itself
|
||||
|
||||
Reference in New Issue
Block a user