fix test + lint

This commit is contained in:
zandercymatics 2024-11-01 10:15:40 -06:00
parent b05a62ecd1
commit 7cdfb7a35f
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
2 changed files with 10 additions and 9 deletions

View file

@ -43,9 +43,6 @@ class RequestingEntityForm(RegistrarForm):
required=False, required=False,
queryset=Suborganization.objects.none(), queryset=Suborganization.objects.none(),
empty_label="--Select--", empty_label="--Select--",
error_messages={
"required": ("Requesting entity is required.")
},
) )
requested_suborganization = forms.CharField( requested_suborganization = forms.CharField(
label="Requested suborganization", label="Requested suborganization",
@ -118,13 +115,13 @@ class RequestingEntityForm(RegistrarForm):
if is_requesting_new_suborganization: if is_requesting_new_suborganization:
# Validate custom suborganization fields # Validate custom suborganization fields
if not cleaned_data.get("requested_suborganization"): if not cleaned_data.get("requested_suborganization"):
self.add_error("requested_suborganization", "Enter details for your organization name.") self.add_error("requested_suborganization", "Organization name is required.")
if not cleaned_data.get("suborganization_city"): if not cleaned_data.get("suborganization_city"):
self.add_error("suborganization_city", "Enter details for your city.") self.add_error("suborganization_city", "City is required.")
if not cleaned_data.get("suborganization_state_territory"): if not cleaned_data.get("suborganization_state_territory"):
self.add_error("suborganization_state_territory", "Enter details for your state or territory.") self.add_error("suborganization_state_territory", "State or territory is required.")
elif not suborganization: elif not suborganization:
self.add_error("sub_organization", "Select a suborganization.") self.add_error("sub_organization", "Suborganization is required.")
return cleaned_data return cleaned_data
@ -138,6 +135,7 @@ class RequestingEntityYesNoForm(BaseYesNoForm):
# IMPORTANT: This is tied to DomainRequest.is_requesting_new_suborganization(). # IMPORTANT: This is tied to DomainRequest.is_requesting_new_suborganization().
# This is due to the from_database method on DomainRequestWizard. # This is due to the from_database method on DomainRequestWizard.
field_name = "requesting_entity_is_suborganization" field_name = "requesting_entity_is_suborganization"
required_error_message = "Requesting entity is required."
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
"""Extend the initialization of the form from RegistrarForm __init__""" """Extend the initialization of the form from RegistrarForm __init__"""
@ -153,7 +151,7 @@ class RequestingEntityYesNoForm(BaseYesNoForm):
def form_is_checked(self): def form_is_checked(self):
""" """
Determines the initial checked state of the form. Determines the initial checked state of the form.
Returns True (checked) if the requesting entity is a suborganization, Returns True (checked) if the requesting entity is a suborganization,
and False if it is a portfolio. Returns None if neither condition is met. and False if it is a portfolio. Returns None if neither condition is met.
""" """
# True means that the requesting entity is a suborganization, # True means that the requesting entity is a suborganization,

View file

@ -1689,7 +1689,7 @@ class TestDomainRequestAdmin(MockEppLib):
request.user = self.staffuser request.user = self.staffuser
readonly_fields = self.admin.get_readonly_fields(request) readonly_fields = self.admin.get_readonly_fields(request)
self.maxDiff = None
expected_fields = [ expected_fields = [
"other_contacts", "other_contacts",
"current_websites", "current_websites",
@ -1709,6 +1709,9 @@ class TestDomainRequestAdmin(MockEppLib):
"cisa_representative_first_name", "cisa_representative_first_name",
"cisa_representative_last_name", "cisa_representative_last_name",
"cisa_representative_email", "cisa_representative_email",
"requested_suborganization",
"suborganization_city",
"suborganization_state_territory",
] ]
self.assertEqual(readonly_fields, expected_fields) self.assertEqual(readonly_fields, expected_fields)