This commit is contained in:
zandercymatics 2024-04-26 08:11:43 -06:00
parent d9408076b1
commit 83c7a5cdfd
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
4 changed files with 30 additions and 10 deletions

View file

@ -252,7 +252,9 @@ class ViewsTest(TestCase):
# mock that callback returns user_info; this is the expected behavior
mock_client.callback.side_effect = self.user_info
# patch that the request does not require step up auth
with patch("djangooidc.views._requires_step_up_auth", return_value=False), patch("djangooidc.views._initialize_client") as mock_init_client:
with patch("djangooidc.views._requires_step_up_auth", return_value=False), patch(
"djangooidc.views._initialize_client"
) as mock_init_client:
with patch("djangooidc.views._client_is_none", return_value=True):
# TEST
# test the login callback url
@ -283,7 +285,9 @@ class ViewsTest(TestCase):
# mock that callback returns user_info; this is the expected behavior
mock_client.callback.side_effect = self.user_info
# patch that the request does not require step up auth
with patch("djangooidc.views._requires_step_up_auth", return_value=False), patch("djangooidc.views._initialize_client") as mock_init_client:
with patch("djangooidc.views._requires_step_up_auth", return_value=False), patch(
"djangooidc.views._initialize_client"
) as mock_init_client:
with patch("djangooidc.views._client_is_none", return_value=True):
# TEST
# test the login callback url
@ -314,7 +318,9 @@ class ViewsTest(TestCase):
td, _ = TransitionDomain.objects.get_or_create(username="test@example.com", domain_name="test123.gov")
# patch that the request does not require step up auth
with patch("djangooidc.views._requires_step_up_auth", return_value=False), patch("djangooidc.views._initialize_client") as mock_init_client:
with patch("djangooidc.views._requires_step_up_auth", return_value=False), patch(
"djangooidc.views._initialize_client"
) as mock_init_client:
with patch("djangooidc.views._client_is_none", return_value=True):
# TEST
# test the login callback url
@ -346,7 +352,9 @@ class ViewsTest(TestCase):
vip, _ = VerifiedByStaff.objects.get_or_create(email="test@example.com")
# patch that the request does not require step up auth
with patch("djangooidc.views._requires_step_up_auth", return_value=False), patch("djangooidc.views._initialize_client") as mock_init_client:
with patch("djangooidc.views._requires_step_up_auth", return_value=False), patch(
"djangooidc.views._initialize_client"
) as mock_init_client:
with patch("djangooidc.views._client_is_none", return_value=True):
# TEST
# test the login callback url

View file

@ -563,7 +563,12 @@ class MyUserAdmin(BaseUserAdmin):
analyst_fieldsets = (
(
None,
{"fields": ("status", "verification_type",)},
{
"fields": (
"status",
"verification_type",
)
},
),
("Personal Info", {"fields": ("first_name", "last_name", "email")}),
(

View file

@ -1,4 +1,3 @@
from enum import Enum
import logging
from django.contrib.auth.models import AbstractUser

View file

@ -3043,7 +3043,15 @@ class TestMyUserAdmin(TestCase):
request.user = create_user()
fieldsets = self.admin.get_fieldsets(request)
expected_fieldsets = (
(None, {"fields": ("status", "verification_type",)}),
(
None,
{
"fields": (
"status",
"verification_type",
)
},
),
("Personal Info", {"fields": ("first_name", "last_name", "email")}),
("Permissions", {"fields": ("is_active", "groups")}),
("Important dates", {"fields": ("last_login", "date_joined")}),