This commit is contained in:
Rachid Mrad 2024-02-01 18:28:00 -05:00
parent 1130b5db8e
commit 4335271656
No known key found for this signature in database
2 changed files with 31 additions and 32 deletions

View file

@ -6,8 +6,6 @@ from django.test import Client, TestCase
from django.urls import reverse from django.urls import reverse
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib.sessions.models import Session
from .common import MockEppLib, MockSESClient, completed_application, create_user # type: ignore from .common import MockEppLib, MockSESClient, completed_application, create_user # type: ignore
from django_webtest import WebTest # type: ignore from django_webtest import WebTest # type: ignore
import boto3_mocking # type: ignore import boto3_mocking # type: ignore
@ -2390,21 +2388,21 @@ class TestWizardUnlockingSteps(TestWithUser, WebTest):
"""Test when all fields in the application are empty.""" """Test when all fields in the application are empty."""
unlocked_steps = self.wizard.db_check_for_unlocking_steps() unlocked_steps = self.wizard.db_check_for_unlocking_steps()
expected_dict = { expected_dict = {
'about_your_organization': False, "about_your_organization": False,
'anything_else': False, "anything_else": False,
'authorizing_official': False, "authorizing_official": False,
'current_sites': False, "current_sites": False,
'dotgov_domain': False, "dotgov_domain": False,
'organization_contact': False, "organization_contact": False,
'organization_election': False, "organization_election": False,
'organization_federal': False, "organization_federal": False,
'organization_type': False, "organization_type": False,
'other_contacts': False, "other_contacts": False,
'purpose': False, "purpose": False,
'requirements': False, "requirements": False,
'review': False, "review": False,
'tribal_government': False, "tribal_government": False,
'your_contact': False "your_contact": False,
} }
self.assertEqual(unlocked_steps, expected_dict) self.assertEqual(unlocked_steps, expected_dict)
@ -2435,9 +2433,9 @@ class TestWizardUnlockingSteps(TestWithUser, WebTest):
detail_page = response.follow() detail_page = response.follow()
self.wizard.get_context_data() self.wizard.get_context_data()
except: except Exception as err:
# Handle any potential errors while following the redirect # Handle any potential errors while following the redirect
self.fail("Error following the redirect") self.fail(f"Error following the redirect {err}")
# Now 'detail_page' contains the response after following the redirect # Now 'detail_page' contains the response after following the redirect
self.assertEqual(detail_page.status_code, 200) self.assertEqual(detail_page.status_code, 200)
@ -2501,15 +2499,15 @@ class TestWizardUnlockingSteps(TestWithUser, WebTest):
detail_page = response.follow() detail_page = response.follow()
self.wizard.get_context_data() self.wizard.get_context_data()
except: except Exception as err:
# Handle any potential errors while following the redirect # Handle any potential errors while following the redirect
self.fail("Error following the redirect") self.fail(f"Error following the redirect {err}")
# Now 'detail_page' contains the response after following the redirect # Now 'detail_page' contains the response after following the redirect
self.assertEqual(detail_page.status_code, 200) self.assertEqual(detail_page.status_code, 200)
# 5 unlocked steps (ao, domain, submitter, other contacts, and current sites which unlocks if domain exists), # 5 unlocked steps (ao, domain, submitter, other contacts, and current sites
# one active step, the review step is locked # which unlocks if domain exists), one active step, the review step is locked
self.assertContains(detail_page, "#check_circle", count=5) self.assertContains(detail_page, "#check_circle", count=5)
# Type of organization # Type of organization
self.assertContains(detail_page, "usa-current", count=1) self.assertContains(detail_page, "usa-current", count=1)

View file

@ -344,10 +344,13 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
"organization_federal": bool(self.application.federal_type), "organization_federal": bool(self.application.federal_type),
"organization_election": bool(self.application.is_election_board), "organization_election": bool(self.application.is_election_board),
"organization_contact": ( "organization_contact": (
bool(self.application.federal_agency) or bool(self.application.organization_name) or bool(self.application.federal_agency)
bool(self.application.address_line1) or bool(self.application.city) or or bool(self.application.organization_name)
bool(self.application.state_territory) or bool(self.application.zipcode) or or bool(self.application.address_line1)
bool(self.application.urbanization) or bool(self.application.city)
or bool(self.application.state_territory)
or bool(self.application.zipcode)
or bool(self.application.urbanization)
), ),
"about_your_organization": bool(self.application.about_your_organization), "about_your_organization": bool(self.application.about_your_organization),
"authorizing_official": bool(self.application.authorizing_official), "authorizing_official": bool(self.application.authorizing_official),
@ -360,9 +363,7 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
"other_contacts": ( "other_contacts": (
bool(self.application.other_contacts.exists()) or bool(self.application.no_other_contacts_rationale) bool(self.application.other_contacts.exists()) or bool(self.application.no_other_contacts_rationale)
), ),
"anything_else": ( "anything_else": (bool(self.application.anything_else) or bool(self.application.is_policy_acknowledged)),
bool(self.application.anything_else) or bool(self.application.is_policy_acknowledged)
),
"requirements": bool(self.application.is_policy_acknowledged), "requirements": bool(self.application.is_policy_acknowledged),
"review": bool(self.application.is_policy_acknowledged), "review": bool(self.application.is_policy_acknowledged),
} }