Add in new unit tests and fix logic

This commit is contained in:
Rebecca Hsieh 2024-05-24 14:50:28 -07:00
parent 30b4ad97a3
commit 03fff1e603
No known key found for this signature in database
4 changed files with 89 additions and 151 deletions

View file

@ -374,110 +374,6 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
}
return [key for key, value in history_dict.items() if value]
# def _is_federal_complete(self):
# # Federal -> "Federal government branch" page can't be empty + Federal Agency selection can't be None
# return not (self.domain_request.federal_type is None or self.domain_request.federal_agency is None)
# def _is_interstate_complete(self):
# # Interstate -> "About your organization" page can't be empty
# return self.domain_request.about_your_organization is not None
# def _is_state_or_territory_complete(self):
# # State -> ""Election office" page can't be empty
# return self.domain_request.is_election_board is not None
# def _is_tribal_complete(self):
# # Tribal -> "Tribal name" and "Election office" page can't be empty
# return self.domain_request.tribe_name is not None and self.domain_request.is_election_board is not None
# def _is_county_complete(self):
# # County -> "Election office" page can't be empty
# return self.domain_request.is_election_board is not None
# def _is_city_complete(self):
# # City -> "Election office" page can't be empty
# return self.domain_request.is_election_board is not None
# def _is_special_district_complete(self):
# # Special District -> "Election office" and "About your organization" page can't be empty
# return (
# self.domain_request.is_election_board is not None
# and self.domain_request.about_your_organization is not None
# )
# def _is_organization_name_and_address_complete(self):
# return not (
# self.domain_request.organization_name is None
# or self.domain_request.address_line1 is None
# or self.domain_request.city is None
# or self.domain_request.state_territory is None
# or self.domain_request.zipcode is None
# )
# def _is_authorizing_official_complete(self):
# return self.domain_request.authorizing_official is not None
# def _is_requested_domain_complete(self):
# return self.domain_request.requested_domain is not None
# def _is_purpose_complete(self):
# return self.domain_request.purpose is not None
# def _is_submitter_complete(self):
# return self.domain_request.submitter is not None
# def _is_other_contacts_complete(self):
# return self.domain_request.other_contacts is not None
# def _is_additional_details_complete(self):
# return not (
# self.domain_request.has_cisa_representative is None
# or self.domain_request.has_anything_else_text is None
# # RARE EDGE CASE: You click yes on having a cisa rep, but you dont type in email (should block in form)
# or (
# self.domain_request.has_cisa_representative is True
# and self.domain_request.cisa_representative_email is None
# )
# or self.domain_request.is_policy_acknowledged is None
# )
# def _is_general_form_complete(self):
# return (
# self._is_organization_name_and_address_complete()
# and self._is_authorizing_official_complete()
# and self._is_requested_domain_complete()
# and self._is_purpose_complete()
# and self._is_submitter_complete()
# and self._is_other_contacts_complete()
# and self._is_additional_details_complete()
# )
# def _form_complete(self):
# if self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.FEDERAL:
# is_complete = self._is_federal_complete()
# elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.INTERSTATE:
# is_complete = self._is_interstate_complete()
# elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.STATE_OR_TERRITORY:
# is_complete = self._is_state_or_territory_complete()
# elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.TRIBAL:
# is_complete = self._is_tribal_complete()
# elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.COUNTY:
# is_complete = self._is_county_complete()
# elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.CITY:
# is_complete = self._is_city_complete()
# elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.SPECIAL_DISTRICT:
# is_complete = self._is_special_district_complete()
# else:
# # NOTE: This shouldn't happen, this is only if somehow they didn't choose an org type
# is_complete = False
# if not is_complete or not self._is_general_form_complete():
# print("!!!! We are in the False if statement - form is not complete")
# return False
# print("!!!! We are in the True if statement - form is complete")
# return True
def get_context_data(self):
"""Define context for access on all wizard pages."""
# Build the submit button that we'll pass to the modal.