mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-17 18:09:25 +02:00
solidify the bool checks on db_check_for_unlocking_steps
This commit is contained in:
parent
b4cd403939
commit
81c8fe97fa
3 changed files with 42 additions and 24 deletions
|
@ -2431,7 +2431,7 @@ class TestWizardUnlockingSteps(TestWithUser, WebTest):
|
||||||
self.assertContains(detail_page, "link_usa-checked", count=11)
|
self.assertContains(detail_page, "link_usa-checked", count=11)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.fail("Expected a redirect, but got a different response")
|
self.fail(f"Expected a redirect, but got a different response: {response}")
|
||||||
|
|
||||||
def test_unlocked_steps_partial_application(self):
|
def test_unlocked_steps_partial_application(self):
|
||||||
"""Test when some fields in the application are filled."""
|
"""Test when some fields in the application are filled."""
|
||||||
|
@ -2498,7 +2498,7 @@ class TestWizardUnlockingSteps(TestWithUser, WebTest):
|
||||||
self.assertContains(detail_page, "link_usa-checked", count=5)
|
self.assertContains(detail_page, "link_usa-checked", count=5)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.fail("Expected a redirect, but got a different response")
|
self.fail(f"Expected a redirect, but got a different response: {response}")
|
||||||
|
|
||||||
|
|
||||||
class TestWithDomainPermissions(TestWithUser):
|
class TestWithDomainPermissions(TestWithUser):
|
||||||
|
|
|
@ -92,6 +92,12 @@ def parse_row(columns, domain_info: DomainInformation, security_emails_dict=None
|
||||||
"Deleted": domain.deleted,
|
"Deleted": domain.deleted,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# user_emails = [user.email for user in domain.permissions]
|
||||||
|
|
||||||
|
# Dynamically add user emails to the FIELDS dictionary
|
||||||
|
# for i, user_email in enumerate(user_emails, start=1):
|
||||||
|
# FIELDS[f"User{i} email"] = user_email
|
||||||
|
|
||||||
row = [FIELDS.get(column, "") for column in columns]
|
row = [FIELDS.get(column, "") for column in columns]
|
||||||
return row
|
return row
|
||||||
|
|
||||||
|
@ -127,6 +133,16 @@ def write_body(
|
||||||
else:
|
else:
|
||||||
logger.warning("csv_export -> Domain was none for PublicContact")
|
logger.warning("csv_export -> Domain was none for PublicContact")
|
||||||
|
|
||||||
|
# all_user_nums = 0
|
||||||
|
# for domain_info in all_domain_infos:
|
||||||
|
# user_num = len(domain_info.domain.permissions)
|
||||||
|
# all_user_nums.append(user_num)
|
||||||
|
|
||||||
|
# if user_num > highest_user_nums:
|
||||||
|
# highest_user_nums = user_num
|
||||||
|
|
||||||
|
# Build the header here passing to it highest_user_nums
|
||||||
|
|
||||||
# Reduce the memory overhead when performing the write operation
|
# Reduce the memory overhead when performing the write operation
|
||||||
paginator = Paginator(all_domain_infos, 1000)
|
paginator = Paginator(all_domain_infos, 1000)
|
||||||
for page_num in paginator.page_range:
|
for page_num in paginator.page_range:
|
||||||
|
|
|
@ -338,35 +338,37 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
|
||||||
def db_check_for_unlocking_steps(self):
|
def db_check_for_unlocking_steps(self):
|
||||||
"""Helper for get_context_data
|
"""Helper for get_context_data
|
||||||
|
|
||||||
Queries the DB for an application and returns a dict for unlocked steps."""
|
Queries the DB for an application and returns a list of unlocked steps."""
|
||||||
history_dict = {
|
history_dict = {
|
||||||
"organization_type": bool(self.application.organization_type),
|
"organization_type": self.application.organization_type is not None,
|
||||||
"tribal_government": bool(self.application.tribe_name),
|
"tribal_government": self.application.tribe_name is not None,
|
||||||
"organization_federal": bool(self.application.federal_type),
|
"organization_federal": self.application.federal_type is not None,
|
||||||
"organization_election": bool(self.application.is_election_board),
|
"organization_election": self.application.is_election_board is not None,
|
||||||
"organization_contact": (
|
"organization_contact": (
|
||||||
bool(self.application.federal_agency)
|
self.application.federal_agency is not None
|
||||||
or bool(self.application.organization_name)
|
or self.application.organization_name is not None
|
||||||
or bool(self.application.address_line1)
|
or self.application.address_line1 is not None
|
||||||
or bool(self.application.city)
|
or self.application.city is not None
|
||||||
or bool(self.application.state_territory)
|
or self.application.state_territory is not None
|
||||||
or bool(self.application.zipcode)
|
or self.application.zipcode is not None
|
||||||
or bool(self.application.urbanization)
|
or self.application.urbanization is not None
|
||||||
),
|
),
|
||||||
"about_your_organization": bool(self.application.about_your_organization),
|
"about_your_organization": self.application.about_your_organization is not None,
|
||||||
"authorizing_official": bool(self.application.authorizing_official),
|
"authorizing_official": self.application.authorizing_official is not None,
|
||||||
"current_sites": (
|
"current_sites": (
|
||||||
bool(self.application.current_websites.exists()) or bool(self.application.requested_domain)
|
self.application.current_websites.exists() or self.application.requested_domain is not None
|
||||||
),
|
),
|
||||||
"dotgov_domain": bool(self.application.requested_domain),
|
"dotgov_domain": self.application.requested_domain is not None,
|
||||||
"purpose": bool(self.application.purpose),
|
"purpose": self.application.purpose is not None,
|
||||||
"your_contact": bool(self.application.submitter),
|
"your_contact": self.application.submitter is not None,
|
||||||
"other_contacts": (
|
"other_contacts": (
|
||||||
bool(self.application.other_contacts.exists()) or bool(self.application.no_other_contacts_rationale)
|
self.application.other_contacts.exists() or self.application.no_other_contacts_rationale is not None
|
||||||
),
|
),
|
||||||
"anything_else": (bool(self.application.anything_else) or bool(self.application.is_policy_acknowledged)),
|
"anything_else": (
|
||||||
"requirements": bool(self.application.is_policy_acknowledged),
|
self.application.anything_else is not None or self.application.is_policy_acknowledged is not None
|
||||||
"review": bool(self.application.is_policy_acknowledged),
|
),
|
||||||
|
"requirements": self.application.is_policy_acknowledged is not None,
|
||||||
|
"review": self.application.is_policy_acknowledged is not None,
|
||||||
}
|
}
|
||||||
return [key for key, value in history_dict.items() if value]
|
return [key for key, value in history_dict.items() if value]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue