mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
merge from main
This commit is contained in:
@@ -2306,10 +2306,8 @@ def test_resume_service_after_confirm(
|
||||
),
|
||||
)
|
||||
|
||||
assert mock_api.called_once_with(
|
||||
"/service/{}/resume".format(SERVICE_ONE_ID), data=None
|
||||
)
|
||||
assert mock_event.called_once_with(
|
||||
mock_api.assert_called_once_with(f"/service/{SERVICE_ONE_ID}/resume", data=None)
|
||||
mock_event.assert_called_once_with(
|
||||
service_id=SERVICE_ONE_ID, resumed_by_id=user["id"]
|
||||
)
|
||||
|
||||
|
||||
@@ -221,7 +221,9 @@ def test_if_existing_user_accepts_twice_they_redirect_to_sign_in(
|
||||
page.select("main p")[0].text.strip(),
|
||||
) == (
|
||||
"You need to sign in again",
|
||||
"We signed you out because you have not used Notify for a while.",
|
||||
# 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 don’t let people update `email_access_validated_at` using an
|
||||
# already-accepted invite
|
||||
@@ -335,7 +337,9 @@ def test_existing_user_of_service_get_redirected_to_signin(
|
||||
page.select("main p")[0].text.strip(),
|
||||
) == (
|
||||
"You need to sign in again",
|
||||
"We signed you out because you have not used Notify for a while.",
|
||||
# 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",
|
||||
)
|
||||
assert mock_accept_invite.call_count == 1
|
||||
|
||||
@@ -424,7 +428,9 @@ def test_existing_signed_out_user_accept_invite_redirects_to_sign_in(
|
||||
page.select("main p")[0].text.strip(),
|
||||
) == (
|
||||
"You need to sign in again",
|
||||
"We signed you out because you have not used Notify for a while.",
|
||||
# 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",
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ def test_find_users_by_email_displays_users_found(
|
||||
mocker.patch(
|
||||
"app.user_api_client.find_users_by_full_or_partial_email",
|
||||
return_value={"data": [user_json()]},
|
||||
autospec=True,
|
||||
)
|
||||
document = client_request.post(
|
||||
"main.find_users_by_email",
|
||||
@@ -57,7 +56,6 @@ def test_find_users_by_email_displays_multiple_users(
|
||||
return_value={
|
||||
"data": [user_json(name="Apple Jack"), user_json(name="Apple Bloom")]
|
||||
},
|
||||
autospec=True,
|
||||
)
|
||||
document = client_request.post(
|
||||
"main.find_users_by_email", _data={"search": "apple"}, _expected_status=200
|
||||
@@ -80,7 +78,6 @@ def test_find_users_by_email_displays_message_if_no_users_found(
|
||||
mocker.patch(
|
||||
"app.user_api_client.find_users_by_full_or_partial_email",
|
||||
return_value={"data": []},
|
||||
autospec=True,
|
||||
)
|
||||
document = client_request.post(
|
||||
"main.find_users_by_email",
|
||||
@@ -125,7 +122,6 @@ def test_user_information_page_shows_information_about_user(
|
||||
side_effect=[
|
||||
user_json(name="Apple Bloom", services=[user_service_one, user_service_two])
|
||||
],
|
||||
autospec=True,
|
||||
)
|
||||
|
||||
mocker.patch(
|
||||
@@ -141,7 +137,6 @@ def test_user_information_page_shows_information_about_user(
|
||||
{"id": user_service_two, "name": "Nature Therapy", "restricted": False},
|
||||
],
|
||||
},
|
||||
autospec=True,
|
||||
)
|
||||
page = client_request.get("main.user_information", user_id=fake_uuid)
|
||||
|
||||
@@ -184,7 +179,6 @@ def test_user_information_page_shows_change_auth_type_link(
|
||||
id_=api_user_active["id"], name="Apple Bloom", auth_type="sms_auth"
|
||||
)
|
||||
],
|
||||
autospec=True,
|
||||
)
|
||||
|
||||
page = client_request.get("main.user_information", user_id=api_user_active["id"])
|
||||
@@ -209,7 +203,6 @@ def test_change_user_auth_preselects_current_auth_type(
|
||||
auth_type=current_auth_type,
|
||||
)
|
||||
],
|
||||
autospec=True,
|
||||
)
|
||||
|
||||
checked_radios = client_request.get(
|
||||
@@ -231,7 +224,6 @@ def test_change_user_auth(client_request, platform_admin_user, api_user_active,
|
||||
id_=api_user_active["id"], name="Apple Bloom", auth_type="sms_auth"
|
||||
)
|
||||
],
|
||||
autospec=True,
|
||||
)
|
||||
|
||||
mock_update = mocker.patch("app.user_api_client.update_user_attribute")
|
||||
@@ -261,13 +253,11 @@ def test_user_information_page_displays_if_there_are_failed_login_attempts(
|
||||
mocker.patch(
|
||||
"app.user_api_client.get_user",
|
||||
side_effect=[user_json(name="Apple Bloom", failed_login_count=2)],
|
||||
autospec=True,
|
||||
)
|
||||
|
||||
mocker.patch(
|
||||
"app.user_api_client.get_organizations_and_services_for_user",
|
||||
return_value={"organizations": [], "services": []},
|
||||
autospec=True,
|
||||
)
|
||||
page = client_request.get("main.user_information", user_id=fake_uuid)
|
||||
|
||||
@@ -302,7 +292,6 @@ def test_user_information_page_does_not_show_archive_link_for_inactive_users(
|
||||
mocker.patch(
|
||||
"app.user_api_client.get_user",
|
||||
side_effect=[platform_admin_user, inactive_user],
|
||||
autospec=True,
|
||||
)
|
||||
|
||||
page = client_request.get("main.user_information", user_id=inactive_user_id)
|
||||
|
||||
@@ -24,8 +24,11 @@ def test_render_sign_in_template_for_new_user(client_request):
|
||||
# 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")[0].text == "Forgot your password?"
|
||||
assert page.select("main a")[0]["href"] == url_for("main.forgot_password")
|
||||
assert page.select("main a")[1].text == "Forgot your password?"
|
||||
assert page.select("main a")[1]["href"] == url_for("main.forgot_password")
|
||||
|
||||
# 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)
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,10 @@ def test_raises_when_overriding_custom_properties():
|
||||
with pytest.raises(AttributeError) as e:
|
||||
Custom({"foo": "NOPE"})
|
||||
|
||||
assert str(e.value) == "can't set attribute"
|
||||
assert (
|
||||
str(e.value)
|
||||
== "property 'foo' of 'test_raises_when_overriding_custom_properties.<locals>.Custom' object has no setter"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
@@ -2,7 +2,7 @@ import uuid
|
||||
from unittest.mock import call
|
||||
|
||||
import pytest
|
||||
from orderedset import OrderedSet
|
||||
from ordered_set import OrderedSet
|
||||
|
||||
from app.notify_client.template_folder_api_client import TemplateFolderAPIClient
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import pytest
|
||||
from flask import Flask
|
||||
|
||||
from app import create_app
|
||||
from app.utils import merge_jsonlike
|
||||
|
||||
|
||||
@@ -49,3 +51,13 @@ def test_merge_jsonlike_merges_jsonlike_objects_correctly(
|
||||
):
|
||||
merge_jsonlike(source_object, destination_object)
|
||||
assert source_object == expected_result
|
||||
|
||||
|
||||
def test_commit_hash():
|
||||
# Assert that we have trimmed the default (unknown) commit hash to seven characters
|
||||
# The real commit hash is supplied at deploy time.
|
||||
app = Flask("app")
|
||||
create_app(app)
|
||||
|
||||
with app.app_context() as current_app:
|
||||
assert current_app.app.config["COMMIT_HASH"] == "-------"
|
||||
|
||||
Reference in New Issue
Block a user