Fix tests

This commit is contained in:
zandercymatics 2024-10-07 08:41:08 -06:00
parent d6d63127d0
commit 36e2e6cc31
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
2 changed files with 11 additions and 5 deletions

View file

@ -43,7 +43,7 @@ class DomainRequestTests(TestWithUser, WebTest):
super().setUp() super().setUp()
self.federal_agency, _ = FederalAgency.objects.get_or_create(agency="General Services Administration") self.federal_agency, _ = FederalAgency.objects.get_or_create(agency="General Services Administration")
self.app.set_user(self.user.username) self.app.set_user(self.user.username)
self.TITLES = DomainRequestWizard.titles self.TITLES = DomainRequestWizard.REGULAR_TITLES
def tearDown(self): def tearDown(self):
super().tearDown() super().tearDown()
@ -3186,7 +3186,7 @@ class TestPortfolioDomainRequestViewonly(TestWithUser, WebTest):
super().setUp() super().setUp()
self.federal_agency, _ = FederalAgency.objects.get_or_create(agency="General Services Administration") self.federal_agency, _ = FederalAgency.objects.get_or_create(agency="General Services Administration")
self.app.set_user(self.user.username) self.app.set_user(self.user.username)
self.TITLES = DomainRequestWizard.titles self.TITLES = DomainRequestWizard.REGULAR_TITLES
def tearDown(self): def tearDown(self):
super().tearDown() super().tearDown()

View file

@ -123,8 +123,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
Step.DOTGOV_DOMAIN: lambda self: self.domain_request.requested_domain is not None, Step.DOTGOV_DOMAIN: lambda self: self.domain_request.requested_domain is not None,
Step.PURPOSE: lambda self: self.domain_request.purpose is not None, Step.PURPOSE: lambda self: self.domain_request.purpose is not None,
Step.OTHER_CONTACTS: lambda self: ( Step.OTHER_CONTACTS: lambda self: (
self.domain_request.other_contacts.exists() self.domain_request.other_contacts.exists() or self.domain_request.no_other_contacts_rationale is not None
or self.domain_request.no_other_contacts_rationale is not None
), ),
Step.ADDITIONAL_DETAILS: lambda self: ( Step.ADDITIONAL_DETAILS: lambda self: (
# Additional details is complete as long as "has anything else" and "has cisa rep" are not None # Additional details is complete as long as "has anything else" and "has cisa rep" are not None
@ -152,6 +151,11 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.titles = {}
self.wizard_conditions = {}
self.unlocking_steps = {}
self.steps = None
# Configure titles, wizard_conditions, unlocking_steps, and steps
self.configure_step_options() self.configure_step_options()
self._domain_request = None # for caching self._domain_request = None # for caching
@ -161,7 +165,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
Using this information, we then set three configuration variables. Using this information, we then set three configuration variables.
- self.titles => Returns the page titles for each step - self.titles => Returns the page titles for each step
- self.wizard_conditions => Conditionally shows / hides certain steps - self.wizard_conditions => Conditionally shows / hides certain steps
- self.unlocking_steps => Determines what steps are locked/unlocked - self.unlocking_steps => Determines what steps are locked/unlocked
Then, we create self.steps. Then, we create self.steps.
@ -293,6 +297,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
if not self.is_portfolio and self.request.user.is_org_user(request): if not self.is_portfolio and self.request.user.is_org_user(request):
self.is_portfolio = True self.is_portfolio = True
# Configure titles, wizard_conditions, unlocking_steps, and steps
self.configure_step_options() self.configure_step_options()
current_url = resolve(request.path_info).url_name current_url = resolve(request.path_info).url_name
@ -508,6 +513,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
"""This method handles POST requests.""" """This method handles POST requests."""
if not self.is_portfolio and self.request.user.is_org_user(request): # type: ignore if not self.is_portfolio and self.request.user.is_org_user(request): # type: ignore
self.is_portfolio = True self.is_portfolio = True
# Configure titles, wizard_conditions, unlocking_steps, and steps
self.configure_step_options() self.configure_step_options()
# which button did the user press? # which button did the user press?