mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-03 09:43:33 +02:00
Fix test + lint
This commit is contained in:
parent
68e44eb98e
commit
2a7eb6db81
3 changed files with 7 additions and 6 deletions
|
@ -6,7 +6,7 @@ from registrar.models import (
|
|||
User,
|
||||
UserGroup,
|
||||
)
|
||||
from registrar.models.verified_by_staff import VerifiedByStaff
|
||||
|
||||
|
||||
fake = Faker()
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
|
@ -29,12 +29,13 @@ class User(AbstractUser):
|
|||
Users achieve access to our system in a few different ways.
|
||||
These choices reflect those pathways.
|
||||
"""
|
||||
|
||||
GRANDFATHERED = "grandfathered", "Legacy user"
|
||||
VERIFIED_BY_STAFF = "verified_by_staff", "Verified by staff"
|
||||
REGULAR = "regular", "Verified by Login.gov"
|
||||
INVITED = "invited", "Invited by a domain manager"
|
||||
# We need a type for fixture users (rather than using verified by staff)
|
||||
# because those users still do get "verified" through normal means
|
||||
# because those users still do get "verified" through normal means
|
||||
# after they login.
|
||||
FIXTURE_USER = "fixture_user", "Created by fixtures"
|
||||
|
||||
|
@ -153,7 +154,7 @@ class User(AbstractUser):
|
|||
@classmethod
|
||||
def get_verification_type_from_email(cls, email, invitation_status=DomainInvitation.DomainInvitationStatus.INVITED):
|
||||
"""Retrieves the verification type based off of a provided email address"""
|
||||
|
||||
|
||||
verification_type = None
|
||||
if TransitionDomain.objects.filter(username=email).exists():
|
||||
# A new incoming user who is a domain manager for one of the domains
|
||||
|
@ -164,12 +165,12 @@ class User(AbstractUser):
|
|||
# New users flagged by Staff to bypass ial2
|
||||
verification_type = cls.VerificationTypeChoices.VERIFIED_BY_STAFF
|
||||
elif DomainInvitation.objects.filter(email=email, status=invitation_status).exists():
|
||||
# A new incoming user who is being invited to be a domain manager (that is,
|
||||
# A new incoming user who is being invited to be a domain manager (that is,
|
||||
# their email address is in DomainInvitation for an invitation that is not yet "retrieved").
|
||||
verification_type = cls.VerificationTypeChoices.INVITED
|
||||
else:
|
||||
verification_type = cls.VerificationTypeChoices.REGULAR
|
||||
|
||||
|
||||
return verification_type
|
||||
|
||||
def check_domain_invitations_on_login(self):
|
||||
|
|
|
@ -2820,7 +2820,7 @@ class MyUserAdminTest(TestCase):
|
|||
request.user = create_user()
|
||||
fieldsets = self.admin.get_fieldsets(request)
|
||||
expected_fieldsets = (
|
||||
(None, {"fields": ("password", "status")}),
|
||||
(None, {"fields": ("password", "status", "verification_type")}),
|
||||
("Personal Info", {"fields": ("first_name", "last_name", "email")}),
|
||||
("Permissions", {"fields": ("is_active", "groups")}),
|
||||
("Important dates", {"fields": ("last_login", "date_joined")}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue