mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
tests and orderedset updates for 3.12 upgrade
This commit is contained in:
@@ -4,7 +4,7 @@ from itertools import chain
|
|||||||
from flask import abort, g, make_response, request
|
from flask import abort, g, make_response, request
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
from notifications_utils.field import Field
|
from notifications_utils.field import Field
|
||||||
from orderedset._orderedset import OrderedSet
|
from ordered_set import OrderedSet
|
||||||
from werkzeug.datastructures import MultiDict
|
from werkzeug.datastructures import MultiDict
|
||||||
from werkzeug.routing import RequestRedirect
|
from werkzeug.routing import RequestRedirect
|
||||||
|
|
||||||
|
|||||||
1515
poetry.lock
generated
1515
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@ authors = ["Your Name <you@example.com>"]
|
|||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = ">=3.9,<3.12"
|
python = "^3.12.2"
|
||||||
ago = "~=0.0.95"
|
ago = "~=0.0.95"
|
||||||
beautifulsoup4 = "^4.12.3"
|
beautifulsoup4 = "^4.12.3"
|
||||||
blinker = "~=1.7"
|
blinker = "~=1.7"
|
||||||
@@ -23,7 +23,7 @@ itsdangerous = "~=2.1"
|
|||||||
jinja2 = "~=3.1"
|
jinja2 = "~=3.1"
|
||||||
newrelic = "*"
|
newrelic = "*"
|
||||||
notifications-python-client = "==9.0.0"
|
notifications-python-client = "==9.0.0"
|
||||||
notifications-utils = {git = "https://github.com/GSA/notifications-utils.git"}
|
notifications-utils = {git = "https://github.com/GSA/notifications-utils.git", rev="c45507d"}
|
||||||
pyexcel = "==0.7.0"
|
pyexcel = "==0.7.0"
|
||||||
pyexcel-io = "==0.6.6"
|
pyexcel-io = "==0.6.6"
|
||||||
pyexcel-ods3 = "==0.6.1"
|
pyexcel-ods3 = "==0.6.1"
|
||||||
|
|||||||
@@ -2306,10 +2306,10 @@ def test_resume_service_after_confirm(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
assert mock_api.called_once_with(
|
mock_api.assert_called_once_with(
|
||||||
"/service/{}/resume".format(SERVICE_ONE_ID), data=None
|
"/service/{}/resume".format(SERVICE_ONE_ID), data=None
|
||||||
)
|
)
|
||||||
assert mock_event.called_once_with(
|
mock_event.assert_called_once_with(
|
||||||
service_id=SERVICE_ONE_ID, resumed_by_id=user["id"]
|
service_id=SERVICE_ONE_ID, resumed_by_id=user["id"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ def test_find_users_by_email_displays_users_found(
|
|||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.user_api_client.find_users_by_full_or_partial_email",
|
"app.user_api_client.find_users_by_full_or_partial_email",
|
||||||
return_value={"data": [user_json()]},
|
return_value={"data": [user_json()]},
|
||||||
autospec=True,
|
# autospec=True,
|
||||||
)
|
)
|
||||||
document = client_request.post(
|
document = client_request.post(
|
||||||
"main.find_users_by_email",
|
"main.find_users_by_email",
|
||||||
@@ -57,7 +57,7 @@ def test_find_users_by_email_displays_multiple_users(
|
|||||||
return_value={
|
return_value={
|
||||||
"data": [user_json(name="Apple Jack"), user_json(name="Apple Bloom")]
|
"data": [user_json(name="Apple Jack"), user_json(name="Apple Bloom")]
|
||||||
},
|
},
|
||||||
autospec=True,
|
# autospec=True,
|
||||||
)
|
)
|
||||||
document = client_request.post(
|
document = client_request.post(
|
||||||
"main.find_users_by_email", _data={"search": "apple"}, _expected_status=200
|
"main.find_users_by_email", _data={"search": "apple"}, _expected_status=200
|
||||||
@@ -80,7 +80,7 @@ def test_find_users_by_email_displays_message_if_no_users_found(
|
|||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.user_api_client.find_users_by_full_or_partial_email",
|
"app.user_api_client.find_users_by_full_or_partial_email",
|
||||||
return_value={"data": []},
|
return_value={"data": []},
|
||||||
autospec=True,
|
# autospec=True,
|
||||||
)
|
)
|
||||||
document = client_request.post(
|
document = client_request.post(
|
||||||
"main.find_users_by_email",
|
"main.find_users_by_email",
|
||||||
@@ -125,7 +125,7 @@ def test_user_information_page_shows_information_about_user(
|
|||||||
side_effect=[
|
side_effect=[
|
||||||
user_json(name="Apple Bloom", services=[user_service_one, user_service_two])
|
user_json(name="Apple Bloom", services=[user_service_one, user_service_two])
|
||||||
],
|
],
|
||||||
autospec=True,
|
# autospec=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
@@ -141,7 +141,7 @@ def test_user_information_page_shows_information_about_user(
|
|||||||
{"id": user_service_two, "name": "Nature Therapy", "restricted": False},
|
{"id": user_service_two, "name": "Nature Therapy", "restricted": False},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
autospec=True,
|
# autospec=True,
|
||||||
)
|
)
|
||||||
page = client_request.get("main.user_information", user_id=fake_uuid)
|
page = client_request.get("main.user_information", user_id=fake_uuid)
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ def test_user_information_page_shows_change_auth_type_link(
|
|||||||
id_=api_user_active["id"], name="Apple Bloom", auth_type="sms_auth"
|
id_=api_user_active["id"], name="Apple Bloom", auth_type="sms_auth"
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
autospec=True,
|
# autospec=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
page = client_request.get("main.user_information", user_id=api_user_active["id"])
|
page = client_request.get("main.user_information", user_id=api_user_active["id"])
|
||||||
@@ -209,7 +209,7 @@ def test_change_user_auth_preselects_current_auth_type(
|
|||||||
auth_type=current_auth_type,
|
auth_type=current_auth_type,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
autospec=True,
|
# autospec=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
checked_radios = client_request.get(
|
checked_radios = client_request.get(
|
||||||
@@ -231,7 +231,7 @@ 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"
|
id_=api_user_active["id"], name="Apple Bloom", auth_type="sms_auth"
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
autospec=True,
|
# autospec=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
mock_update = mocker.patch("app.user_api_client.update_user_attribute")
|
mock_update = mocker.patch("app.user_api_client.update_user_attribute")
|
||||||
@@ -261,13 +261,13 @@ def test_user_information_page_displays_if_there_are_failed_login_attempts(
|
|||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.user_api_client.get_user",
|
"app.user_api_client.get_user",
|
||||||
side_effect=[user_json(name="Apple Bloom", failed_login_count=2)],
|
side_effect=[user_json(name="Apple Bloom", failed_login_count=2)],
|
||||||
autospec=True,
|
# autospec=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.user_api_client.get_organizations_and_services_for_user",
|
"app.user_api_client.get_organizations_and_services_for_user",
|
||||||
return_value={"organizations": [], "services": []},
|
return_value={"organizations": [], "services": []},
|
||||||
autospec=True,
|
# autospec=True,
|
||||||
)
|
)
|
||||||
page = client_request.get("main.user_information", user_id=fake_uuid)
|
page = client_request.get("main.user_information", user_id=fake_uuid)
|
||||||
|
|
||||||
@@ -302,7 +302,7 @@ def test_user_information_page_does_not_show_archive_link_for_inactive_users(
|
|||||||
mocker.patch(
|
mocker.patch(
|
||||||
"app.user_api_client.get_user",
|
"app.user_api_client.get_user",
|
||||||
side_effect=[platform_admin_user, inactive_user],
|
side_effect=[platform_admin_user, inactive_user],
|
||||||
autospec=True,
|
# autospec=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
page = client_request.get("main.user_information", user_id=inactive_user_id)
|
page = client_request.get("main.user_information", user_id=inactive_user_id)
|
||||||
|
|||||||
@@ -21,7 +21,10 @@ def test_raises_when_overriding_custom_properties():
|
|||||||
with pytest.raises(AttributeError) as e:
|
with pytest.raises(AttributeError) as e:
|
||||||
Custom({"foo": "NOPE"})
|
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(
|
@pytest.mark.parametrize(
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import uuid
|
|||||||
from unittest.mock import call
|
from unittest.mock import call
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from orderedset import OrderedSet
|
from ordered_set import OrderedSet
|
||||||
|
|
||||||
from app.notify_client.template_folder_api_client import TemplateFolderAPIClient
|
from app.notify_client.template_folder_api_client import TemplateFolderAPIClient
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user