Merge branch 'main' of https://github.com/GSA/notifications-admin into notify-871

This commit is contained in:
Andrew Shumway
2023-12-06 12:26:51 -07:00
15 changed files with 148 additions and 93 deletions

View File

@@ -322,7 +322,7 @@ def test_register_from_invite(
"+12024900460",
"somreallyhardthingtoguess",
"sms_auth",
),
)
mock_get_invited_user_by_id.assert_called_once_with(sample_invite["id"])

View File

@@ -739,16 +739,16 @@ def test_choose_a_template_to_copy(
assert page.select(".folder-heading") == []
expected = [
("Service 1 " "4 templates"),
("Service 1 sms_template_one " "Text message template"),
("Service 1 sms_template_two " "Text message template"),
("Service 1 email_template_one " "Email template"),
("Service 1 email_template_two " "Email template"),
("Service 2 " "4 templates"),
("Service 2 sms_template_one " "Text message template"),
("Service 2 sms_template_two " "Text message template"),
("Service 2 email_template_one " "Email template"),
("Service 2 email_template_two " "Email template"),
(""),
("Service 1 sms_template_one"),
("Service 1 sms_template_two"),
("Service 1 email_template_one"),
("Service 1 email_template_two"),
(""),
("Service 2 sms_template_one"),
("Service 2 sms_template_two"),
("Service 2 email_template_one"),
("Service 2 email_template_two"),
]
actual = page.select(".template-list-item")
@@ -763,17 +763,6 @@ def test_choose_a_template_to_copy(
service_id=SERVICE_ONE_ID,
from_service=SERVICE_TWO_ID,
)
assert links[1]["href"] == url_for(
"main.choose_template_to_copy",
service_id=SERVICE_ONE_ID,
from_service=SERVICE_TWO_ID,
)
assert links[2]["href"] == url_for(
"main.copy_template",
service_id=SERVICE_ONE_ID,
template_id=TEMPLATE_ONE_ID,
from_service=SERVICE_TWO_ID,
)
def test_choose_a_template_to_copy_when_user_has_one_service(
@@ -791,10 +780,10 @@ def test_choose_a_template_to_copy_when_user_has_one_service(
assert page.select(".folder-heading") == []
expected = [
("sms_template_one " "Text message template"),
("sms_template_two " "Text message template"),
("email_template_one " "Email template"),
("email_template_two " "Email template"),
("sms_template_one"),
("sms_template_two"),
("email_template_one"),
("email_template_two"),
]
actual = page.select(".template-list-item")
@@ -821,7 +810,7 @@ def test_choose_a_template_to_copy_from_folder_within_service(
):
mock_get_template_folders.return_value = [
_folder("Parent folder", PARENT_FOLDER_ID),
_folder("Child folder empty", CHILD_FOLDER_ID, parent=PARENT_FOLDER_ID),
_folder("", CHILD_FOLDER_ID, parent=PARENT_FOLDER_ID),
_folder("Child folder non-empty", FOLDER_TWO_ID, parent=PARENT_FOLDER_ID),
]
mocker.patch(
@@ -865,13 +854,10 @@ def test_choose_a_template_to_copy_from_folder_within_service(
)
expected = [
("Child folder empty " "Empty"),
("Child folder non-empty " "1 template"),
(
"Child folder non-empty Should appear in list (nested) "
"Text message template"
),
("Should appear in list (at same level) " "Text message template"),
(""),
(""),
("Child folder non-empty Should appear in list (nested)"),
("Should appear in list (at same level)"),
]
actual = page.select(".template-list-item")
@@ -885,26 +871,25 @@ def test_choose_a_template_to_copy_from_folder_within_service(
assert links[0]["href"] == url_for(
"main.choose_template_to_copy",
service_id=SERVICE_ONE_ID,
from_service=SERVICE_ONE_ID,
from_folder=CHILD_FOLDER_ID,
)
assert links[1]["href"] == url_for(
"main.choose_template_to_copy",
service_id=SERVICE_ONE_ID,
from_service=SERVICE_ONE_ID,
from_folder=FOLDER_TWO_ID,
)
assert links[2]["href"] == url_for(
"main.choose_template_to_copy",
service_id=SERVICE_ONE_ID,
from_folder=FOLDER_TWO_ID,
)
assert links[3]["href"] == url_for(
"main.copy_template",
service_id=SERVICE_ONE_ID,
template_id=TEMPLATE_ONE_ID,
from_service=SERVICE_ONE_ID,
)
# assert links[1]["href"] == url_for(
# "main.choose_template_to_copy",
# service_id=SERVICE_ONE_ID,
# from_service=SERVICE_ONE_ID,
# from_folder=PARENT_FOLDER_ID,
# )
# assert links[2]["href"] == url_for(
# "main.choose_template_to_copy",
# service_id=SERVICE_ONE_ID,
# from_folder=FOLDER_TWO_ID,
# )
# assert links[3]["href"] == url_for(
# "main.copy_template",
# service_id=SERVICE_ONE_ID,
# template_id=TEMPLATE_ONE_ID,
# from_service=SERVICE_ONE_ID,
# )
@pytest.mark.parametrize(
@@ -2112,7 +2097,7 @@ def test_content_count_json_endpoint(
html = json.loads(response.get_data(as_text=True))["html"]
snippet = BeautifulSoup(html, "html.parser").select_one("span")
assert normalize_spaces(snippet.text) == expected_message
assert expected_message in normalize_spaces(snippet.text)
if snippet.has_attr("class"):
assert snippet["class"] == [expected_class]

View File

@@ -253,6 +253,7 @@ EXCLUDED_ENDPOINTS = tuple(
"user_profile_mobile_number_delete",
"user_profile_name",
"user_profile_password",
"user_profile_preferred_timezone",
"using_notify",
"verify",
"verify_email",