1423 - Few final updates to switch over to login.gov

This commit is contained in:
Jonathan Bobel
2024-04-15 15:50:42 -04:00
parent 5d0461f52b
commit 6784cf9f3c
5 changed files with 15 additions and 61 deletions

View File

@@ -222,8 +222,7 @@ def test_if_existing_user_accepts_twice_they_redirect_to_sign_in(
) == (
"You need to sign in again",
# TODO: Improve this given Login.gov configuration.
# "We signed you out because you have not used Notify for a while.",
"You have left to use Login.gov to sign in",
"We signed you out because you have not used Notify for a while.",
)
# We dont let people update `email_access_validated_at` using an
# already-accepted invite
@@ -338,8 +337,7 @@ def test_existing_user_of_service_get_redirected_to_signin(
) == (
"You need to sign in again",
# TODO: Improve this given Login.gov configuration.
# "We signed you out because you have not used Notify for a while.",
"You have left to use Login.gov to sign in",
"We signed you out because you have not used Notify for a while.",
)
assert mock_accept_invite.call_count == 1
@@ -429,8 +427,7 @@ def test_existing_signed_out_user_accept_invite_redirects_to_sign_in(
) == (
"You need to sign in again",
# TODO: Improve this given Login.gov configuration.
# "We signed you out because you have not used Notify for a while.",
"You have left to use Login.gov to sign in",
"We signed you out because you have not used Notify for a while.",
)

View File

@@ -12,40 +12,21 @@ def test_render_sign_in_template_for_new_user(client_request):
client_request.logout()
page = client_request.get("main.sign_in")
assert normalize_spaces(page.select_one("h1").text) == "Sign in"
assert normalize_spaces(page.select("label")[0].text) == "Email address"
assert page.select_one("#email_address").get("value") is None
assert page.select_one("#email_address")["autocomplete"] == "email"
assert normalize_spaces(page.select("label")[1].text) == "Password"
assert page.select_one("#password").get("value") is None
assert page.select_one("#password")["autocomplete"] == "current-password"
# Removing for the pilot
# assert page.select('main a')[0].text == 'create one now'
# assert page.select('main a')[0]['href'] == url_for('main.register')
assert (
page.select("main p")[0].text
== "Access your Notify.gov account by signing in with Login.gov:"
)
# TODO: Fix this test to be less brittle! If the Login.gov link is enabled,
# 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")[1].text == "Forgot your password?"
assert page.select("main a")[1]["href"] == url_for("main.forgot_password")
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_render_sign_in_template_with_next_link_for_password_reset(client_request):
client_request.logout()
page = client_request.get(
"main.sign_in",
_optional_args=f"?next=/services/{SERVICE_ONE_ID}/templates",
_test_page_title=False,
)
forgot_password_link = page.find("a", class_="usa-link")
assert forgot_password_link.text == "Forgot your password?"
assert forgot_password_link["href"] == url_for(
"main.forgot_password", next=f"/services/{SERVICE_ONE_ID}/templates"
)
def test_reformat_keystring():
orig = "-----BEGIN PRIVATE KEY----- blah blah blah -----END PRIVATE KEY-----"
expected = """-----BEGIN PRIVATE KEY-----