mirror of
https://github.com/GSA/notifications-admin.git
synced 2025-12-17 10:34:07 -05:00
cleanup notify-compliance-46
This commit is contained in:
@@ -56,6 +56,9 @@ class NotifyAdminAPIClient(BaseAPIClient):
|
|||||||
):
|
):
|
||||||
abort(403)
|
abort(403)
|
||||||
|
|
||||||
|
def is_calling_signin_url(self, arg):
|
||||||
|
return arg[0].startswith("/user")
|
||||||
|
|
||||||
def check_inactive_user(self, *args):
|
def check_inactive_user(self, *args):
|
||||||
still_signing_in = False
|
still_signing_in = False
|
||||||
|
|
||||||
@@ -64,14 +67,15 @@ class NotifyAdminAPIClient(BaseAPIClient):
|
|||||||
# and we only want to check the first arg
|
# and we only want to check the first arg
|
||||||
for arg in args:
|
for arg in args:
|
||||||
arg = str(arg)
|
arg = str(arg)
|
||||||
if (
|
if self.is_calling_signin_url(arg):
|
||||||
"get-login-gov-user" in arg
|
# if (
|
||||||
or "user/email" in arg
|
# "get-login-gov-user" in arg
|
||||||
or "/activate" in arg
|
# or "user/email" in arg
|
||||||
or "/email-code" in arg
|
# or "/activate" in arg
|
||||||
or "/verify/code" in arg
|
# or "/email-code" in arg
|
||||||
or "/user" in arg
|
# or "/verify/code" in arg
|
||||||
):
|
# or "/user" in arg
|
||||||
|
# ):
|
||||||
still_signing_in = True
|
still_signing_in = True
|
||||||
|
|
||||||
# This seems to be a weird edge case that happens intermittently with invites
|
# This seems to be a weird edge case that happens intermittently with invites
|
||||||
|
|||||||
@@ -41,6 +41,25 @@ def test_active_service_can_be_modified(notify_admin, method, user, service):
|
|||||||
assert ret == request.return_value
|
assert ret == request.return_value
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
("arg", "expected_result"),
|
||||||
|
[
|
||||||
|
(
|
||||||
|
("/user/c5f8a5c9-56d5-4fa9-8c30-3449ae10c072/verify/code",),
|
||||||
|
True,
|
||||||
|
),
|
||||||
|
(
|
||||||
|
("/service/blahblahblah",),
|
||||||
|
False,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_is_calling_signin_url(arg, expected_result):
|
||||||
|
api_client = NotifyAdminAPIClient()
|
||||||
|
result = api_client.is_calling_signin_url(arg)
|
||||||
|
assert result == expected_result
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("method", ["put", "post", "delete"])
|
@pytest.mark.parametrize("method", ["put", "post", "delete"])
|
||||||
def test_inactive_service_cannot_be_modified_by_normal_user(
|
def test_inactive_service_cannot_be_modified_by_normal_user(
|
||||||
notify_admin, api_user_active, method
|
notify_admin, api_user_active, method
|
||||||
|
|||||||
Reference in New Issue
Block a user