This commit is contained in:
CocoByte 2024-06-10 13:08:32 -06:00
parent 3d45daab16
commit 8d46b76376
No known key found for this signature in database
GPG key ID: BBFAA2526384C97F
2 changed files with 11 additions and 9 deletions

View file

@ -557,14 +557,15 @@ class DomainRequest(TimeStampedModel):
# This ensures that if we have prefilled data, the form is prepopulated # This ensures that if we have prefilled data, the form is prepopulated
if self.cisa_representative_first_name is not None or self.cisa_representative_last_name is not None: if self.cisa_representative_first_name is not None or self.cisa_representative_last_name is not None:
self.has_cisa_representative = self.cisa_representative_first_name != "" and self.cisa_representative_last_name != "" self.has_cisa_representative = (
self.cisa_representative_first_name != "" and self.cisa_representative_last_name != ""
)
# This check is required to ensure that the form doesn't start out checked # This check is required to ensure that the form doesn't start out checked
if self.has_cisa_representative is not None: if self.has_cisa_representative is not None:
self.has_cisa_representative = ( self.has_cisa_representative = (
(self.cisa_representative_first_name != "" and self.cisa_representative_first_name is not None) self.cisa_representative_first_name != "" and self.cisa_representative_first_name is not None
and (self.cisa_representative_last_name != "" and self.cisa_representative_last_name is not None) ) and (self.cisa_representative_last_name != "" and self.cisa_representative_last_name is not None)
)
# This ensures that if we have prefilled data, the form is prepopulated # This ensures that if we have prefilled data, the form is prepopulated
if self.anything_else is not None: if self.anything_else is not None:
@ -1033,7 +1034,8 @@ class DomainRequest(TimeStampedModel):
return False return False
def _cisa_rep_check(self): def _cisa_rep_check(self):
# Either does not have a CISA rep, OR has a CISA rep + both first name and last name are NOT empty and are NOT an empty string # Either does not have a CISA rep, OR has a CISA rep + both first name
# and last name are NOT empty and are NOT an empty string
return ( return (
self.has_cisa_representative is True self.has_cisa_representative is True
and self.cisa_representative_first_name is not None and self.cisa_representative_first_name is not None

View file

@ -1884,7 +1884,7 @@ class TestDomainRequestIncomplete(TestCase):
# therefore, our expected will be True # therefore, our expected will be True
{ {
"has_cisa_representative": True, "has_cisa_representative": True,
# Above will be overridden to False if cisa_representative_first_name is None bc of sync_yes_no_form_fields # Above will be overridden to False if cisa_representative_first_name is None
"cisa_representative_first_name": None, "cisa_representative_first_name": None,
"cisa_representative_last_name": None, "cisa_representative_last_name": None,
"cisa_representative_email": None, "cisa_representative_email": None,
@ -1898,8 +1898,8 @@ class TestDomainRequestIncomplete(TestCase):
# Email - None # Email - None
# Anything Else Radio - Yes # Anything Else Radio - Yes
# Anything Else Text - None # Anything Else Text - None
# NOTE: We should never have an instance where only firstname or only lastname are populated (they are both required) # NOTE: We should never have an instance where only firstname or only lastname are populated
# However, if this happens, the application will default to False for has_cisa_representative # (they are both required)
{ {
"has_cisa_representative": True, "has_cisa_representative": True,
# Above will be overridden to False if cisa_representative_first_name is None or # Above will be overridden to False if cisa_representative_first_name is None or