mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-01 23:42:17 +02:00
Fix remaining tests (hopefully)
This commit is contained in:
parent
9f6d1324d9
commit
056df7151d
9 changed files with 28 additions and 41 deletions
|
@ -35,21 +35,17 @@ class AllowedEmail(TimeStampedModel):
|
|||
# Check if there's a '+' in the local part
|
||||
if "+" in local:
|
||||
base_local = local.split("+")[0]
|
||||
base_email_exists = cls.objects.filter(
|
||||
Q(email__iexact=f"{base_local}@{domain}")
|
||||
).exists()
|
||||
base_email_exists = cls.objects.filter(Q(email__iexact=f"{base_local}@{domain}")).exists()
|
||||
|
||||
# Given an example email, such as "joe.smoe+1@igorville.com"
|
||||
# The full regex statement will be: "^joe.smoe\\+\\d+@igorville.com$"
|
||||
pattern = f'^{re.escape(base_local)}\\+\\d+@{re.escape(domain)}$'
|
||||
pattern = f"^{re.escape(base_local)}\\+\\d+@{re.escape(domain)}$"
|
||||
return base_email_exists and re.match(pattern, email)
|
||||
else:
|
||||
# Edge case, the +1 record exists but the base does not,
|
||||
# and the record we are checking is the base record.
|
||||
pattern = f'^{re.escape(local)}\\+\\d+@{re.escape(domain)}$'
|
||||
plus_email_exists = cls.objects.filter(
|
||||
Q(email__iregex=pattern)
|
||||
).exists()
|
||||
pattern = f"^{re.escape(local)}\\+\\d+@{re.escape(domain)}$"
|
||||
plus_email_exists = cls.objects.filter(Q(email__iregex=pattern)).exists()
|
||||
return plus_email_exists
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
@ -580,14 +580,8 @@ class DomainRequest(TimeStampedModel):
|
|||
@classmethod
|
||||
def get_statuses_that_send_emails(cls):
|
||||
"""Returns a list of statuses that send an email to the user"""
|
||||
excluded_statuses = [
|
||||
cls.DomainRequestStatus.INELIGIBLE,
|
||||
cls.DomainRequestStatus.IN_REVIEW
|
||||
]
|
||||
return [
|
||||
status for status in cls.DomainRequestStatus
|
||||
if status not in excluded_statuses
|
||||
]
|
||||
excluded_statuses = [cls.DomainRequestStatus.INELIGIBLE, cls.DomainRequestStatus.IN_REVIEW]
|
||||
return [status for status in cls.DomainRequestStatus if status not in excluded_statuses]
|
||||
|
||||
def sync_organization_type(self):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue