mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-11 03:59:41 +02:00
lint
This commit is contained in:
parent
4dba0a31c3
commit
b5935a36d6
2 changed files with 8 additions and 18 deletions
|
@ -1719,7 +1719,7 @@ class TestDomainRequestIncomplete(TestCase):
|
||||||
super().tearDownClass()
|
super().tearDownClass()
|
||||||
cls.user.delete()
|
cls.user.delete()
|
||||||
|
|
||||||
# @less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_is_federal_complete(self):
|
def test_is_federal_complete(self):
|
||||||
self.assertTrue(self.wizard.form_is_complete())
|
self.assertTrue(self.wizard.form_is_complete())
|
||||||
self.domain_request.federal_type = None
|
self.domain_request.federal_type = None
|
||||||
|
@ -1747,7 +1747,7 @@ class TestDomainRequestIncomplete(TestCase):
|
||||||
self.domain_request.save()
|
self.domain_request.save()
|
||||||
self.assertFalse(self.wizard.form_is_complete())
|
self.assertFalse(self.wizard.form_is_complete())
|
||||||
|
|
||||||
# @less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_is_tribal_complete(self):
|
def test_is_tribal_complete(self):
|
||||||
self.domain_request.generic_org_type = DomainRequest.OrganizationChoices.TRIBAL
|
self.domain_request.generic_org_type = DomainRequest.OrganizationChoices.TRIBAL
|
||||||
self.domain_request.tribe_name = "Tribe Name"
|
self.domain_request.tribe_name = "Tribe Name"
|
||||||
|
|
|
@ -425,26 +425,16 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
||||||
return [key for key, is_unlocked_checker in self.unlocking_steps.items() if is_unlocked_checker(self)]
|
return [key for key, is_unlocked_checker in self.unlocking_steps.items() if is_unlocked_checker(self)]
|
||||||
|
|
||||||
def form_is_complete(self):
|
def form_is_complete(self):
|
||||||
"""
|
"""Determines if all required steps in the domain request form are complete.
|
||||||
Determines if all required steps in the domain request form are complete.
|
|
||||||
|
|
||||||
This method:
|
|
||||||
1. Gets a list of all steps that have been completed (unlocked_steps)
|
|
||||||
2. Filters the full step list to only include steps that should be shown based on
|
|
||||||
the wizard conditions. For example, federal-specific steps are only required
|
|
||||||
if the organization type is federal.
|
|
||||||
3. Compares the number of completed steps to required steps to determine if
|
|
||||||
the form is complete.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bool: True if all required steps are complete, False otherwise
|
bool: True if all required steps are complete, False otherwise
|
||||||
"""
|
"""
|
||||||
unlockable_steps = {step.value for step in self.db_check_for_unlocking_steps()}
|
# 1. Get all steps visibly present to the user (required steps)
|
||||||
|
# 2. Return every possible step that is "unlocked" (even hidden, conditional ones)
|
||||||
|
# 3. Narrows down the list to remove hidden conditional steps
|
||||||
required_steps = set(self.steps.all)
|
required_steps = set(self.steps.all)
|
||||||
unlocked_steps = set()
|
unlockable_steps = {step.value for step in self.db_check_for_unlocking_steps()}
|
||||||
for step in required_steps:
|
unlocked_steps = {step for step in required_steps if step in unlockable_steps}
|
||||||
if step in unlockable_steps:
|
|
||||||
unlocked_steps.add(step)
|
|
||||||
return required_steps == unlocked_steps
|
return required_steps == unlocked_steps
|
||||||
|
|
||||||
def get_context_data(self):
|
def get_context_data(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue