mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-14 15:05:14 +02:00
Fix silent bug ib domain_type, add data to tests
This commit is contained in:
parent
cedd54c673
commit
6a87d38749
3 changed files with 23 additions and 5 deletions
|
@ -551,6 +551,9 @@ class MockDb(TestCase):
|
||||||
self.domain_11, _ = Domain.objects.get_or_create(
|
self.domain_11, _ = Domain.objects.get_or_create(
|
||||||
name="cdomain11.gov", state=Domain.State.READY, first_ready=timezone.now()
|
name="cdomain11.gov", state=Domain.State.READY, first_ready=timezone.now()
|
||||||
)
|
)
|
||||||
|
self.domain_12, _ = Domain.objects.get_or_create(
|
||||||
|
name="zdomain12.gov", state=Domain.State.READY, first_ready=timezone.now()
|
||||||
|
)
|
||||||
|
|
||||||
self.domain_information_1, _ = DomainInformation.objects.get_or_create(
|
self.domain_information_1, _ = DomainInformation.objects.get_or_create(
|
||||||
creator=self.user,
|
creator=self.user,
|
||||||
|
@ -627,6 +630,12 @@ class MockDb(TestCase):
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
is_election_board=True,
|
is_election_board=True,
|
||||||
)
|
)
|
||||||
|
self.domain_information_12, _ = DomainInformation.objects.get_or_create(
|
||||||
|
creator=self.user,
|
||||||
|
domain=self.domain_12,
|
||||||
|
generic_org_type="interstate",
|
||||||
|
is_election_board=False,
|
||||||
|
)
|
||||||
|
|
||||||
meoward_user = get_user_model().objects.create(
|
meoward_user = get_user_model().objects.create(
|
||||||
username="meoward_username", first_name="first_meoward", last_name="last_meoward", email="meoward@rocks.com"
|
username="meoward_username", first_name="first_meoward", last_name="last_meoward", email="meoward@rocks.com"
|
||||||
|
@ -656,6 +665,10 @@ class MockDb(TestCase):
|
||||||
user=meoward_user, domain=self.domain_11, role=UserDomainRole.Roles.MANAGER
|
user=meoward_user, domain=self.domain_11, role=UserDomainRole.Roles.MANAGER
|
||||||
)
|
)
|
||||||
|
|
||||||
|
_, created = UserDomainRole.objects.get_or_create(
|
||||||
|
user=meoward_user, domain=self.domain_12, role=UserDomainRole.Roles.MANAGER
|
||||||
|
)
|
||||||
|
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
self.domain_request_1 = completed_domain_request(
|
self.domain_request_1 = completed_domain_request(
|
||||||
status=DomainRequest.DomainRequestStatus.STARTED, name="city1.gov"
|
status=DomainRequest.DomainRequestStatus.STARTED, name="city1.gov"
|
||||||
|
|
|
@ -259,7 +259,8 @@ class ExportDataTest(MockDb, MockEppLib):
|
||||||
"adomain2.gov,Interstate,(blank),Dns needed\n"
|
"adomain2.gov,Interstate,(blank),Dns needed\n"
|
||||||
"cdomain11.govFederal-ExecutiveWorldWarICentennialCommissionReady\n"
|
"cdomain11.govFederal-ExecutiveWorldWarICentennialCommissionReady\n"
|
||||||
"ddomain3.gov,Federal,Armed Forces Retirement Home,123@mail.gov,On hold,2023-05-25\n"
|
"ddomain3.gov,Federal,Armed Forces Retirement Home,123@mail.gov,On hold,2023-05-25\n"
|
||||||
"defaultsecurity.gov,Federal - Executive,World War I Centennial Commission,(blank),Ready"
|
"defaultsecurity.gov,Federal - Executive,World War I Centennial Commission,(blank),Ready\n"
|
||||||
|
"zdomain12.govInterstateReady\n"
|
||||||
)
|
)
|
||||||
# Normalize line endings and remove commas,
|
# Normalize line endings and remove commas,
|
||||||
# spaces and leading/trailing whitespace
|
# spaces and leading/trailing whitespace
|
||||||
|
@ -321,6 +322,7 @@ class ExportDataTest(MockDb, MockEppLib):
|
||||||
"cdomain11.govFederal-ExecutiveWorldWarICentennialCommissionReady\n"
|
"cdomain11.govFederal-ExecutiveWorldWarICentennialCommissionReady\n"
|
||||||
"cdomain1.gov,Federal - Executive,World War I Centennial Commission,Ready\n"
|
"cdomain1.gov,Federal - Executive,World War I Centennial Commission,Ready\n"
|
||||||
"ddomain3.gov,Federal,Armed Forces Retirement Home,On hold\n"
|
"ddomain3.gov,Federal,Armed Forces Retirement Home,On hold\n"
|
||||||
|
"zdomain12.govInterstateReady\n"
|
||||||
)
|
)
|
||||||
# Normalize line endings and remove commas,
|
# Normalize line endings and remove commas,
|
||||||
# spaces and leading/trailing whitespace
|
# spaces and leading/trailing whitespace
|
||||||
|
@ -461,6 +463,7 @@ class ExportDataTest(MockDb, MockEppLib):
|
||||||
"cdomain1.gov,Federal-Executive,World War I Centennial Commission,,,,Ready,\n"
|
"cdomain1.gov,Federal-Executive,World War I Centennial Commission,,,,Ready,\n"
|
||||||
"adomain10.gov,Federal,Armed Forces Retirement Home,,,,Ready,\n"
|
"adomain10.gov,Federal,Armed Forces Retirement Home,,,,Ready,\n"
|
||||||
"cdomain11.govFederal-ExecutiveWorldWarICentennialCommissionReady\n"
|
"cdomain11.govFederal-ExecutiveWorldWarICentennialCommissionReady\n"
|
||||||
|
"zdomain12.govInterstateReady\n"
|
||||||
"zdomain9.gov,Federal,Armed Forces Retirement Home,,,,Deleted,\n"
|
"zdomain9.gov,Federal,Armed Forces Retirement Home,,,,Deleted,\n"
|
||||||
"sdomain8.gov,Federal,Armed Forces Retirement Home,,,,Deleted,\n"
|
"sdomain8.gov,Federal,Armed Forces Retirement Home,,,,Deleted,\n"
|
||||||
"xdomain7.gov,Federal,Armed Forces Retirement Home,,,,Deleted,\n"
|
"xdomain7.gov,Federal,Armed Forces Retirement Home,,,,Deleted,\n"
|
||||||
|
@ -525,6 +528,7 @@ class ExportDataTest(MockDb, MockEppLib):
|
||||||
"cdomain1.gov,Ready,,Federal - Executive,World War I Centennial Commission,,,"
|
"cdomain1.gov,Ready,,Federal - Executive,World War I Centennial Commission,,,"
|
||||||
", , , ,meoward@rocks.com,info@example.com,big_lebowski@dude.co\n"
|
", , , ,meoward@rocks.com,info@example.com,big_lebowski@dude.co\n"
|
||||||
"ddomain3.gov,On hold,,Federal,Armed Forces Retirement Home,,,, , , ,,\n"
|
"ddomain3.gov,On hold,,Federal,Armed Forces Retirement Home,,,, , , ,,\n"
|
||||||
|
"zdomain12.govReadyInterstatemeoward@rocks.com\n"
|
||||||
)
|
)
|
||||||
# Normalize line endings and remove commas,
|
# Normalize line endings and remove commas,
|
||||||
# spaces and leading/trailing whitespace
|
# spaces and leading/trailing whitespace
|
||||||
|
@ -558,11 +562,12 @@ class ExportDataTest(MockDb, MockEppLib):
|
||||||
"MANAGED DOMAINS COUNTS AT END DATE\n"
|
"MANAGED DOMAINS COUNTS AT END DATE\n"
|
||||||
"Total,Federal,Interstate,State or territory,Tribal,County,City,"
|
"Total,Federal,Interstate,State or territory,Tribal,County,City,"
|
||||||
"Special district,School district,Election office\n"
|
"Special district,School district,Election office\n"
|
||||||
"2,2,0,0,0,0,0,0,0,2\n"
|
"3,2,1,0,0,0,0,0,0,2\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Domain name,Domain type,Domain manager email 1,Domain manager email 2,Domain manager email 3\n"
|
"Domain name,Domain type,Domain manager email 1,Domain manager email 2,Domain manager email 3\n"
|
||||||
"cdomain11.govFederal-Executivemeoward@rocks.com\n"
|
"cdomain11.govFederal-Executivemeoward@rocks.com\n"
|
||||||
"cdomain1.gov,Federal - Executive,meoward@rocks.com,info@example.com,big_lebowski@dude.co\n"
|
"cdomain1.gov,Federal - Executive,meoward@rocks.com,info@example.com,big_lebowski@dude.co\n"
|
||||||
|
"zdomain12.govInterstatemeoward@rocks.com\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Normalize line endings and remove commas,
|
# Normalize line endings and remove commas,
|
||||||
|
@ -682,12 +687,12 @@ class HelperFunctions(MockDb):
|
||||||
}
|
}
|
||||||
# Test with distinct
|
# Test with distinct
|
||||||
managed_domains_sliced_at_end_date = get_sliced_domains(filter_condition, True)
|
managed_domains_sliced_at_end_date = get_sliced_domains(filter_condition, True)
|
||||||
expected_content = [2, 2, 0, 0, 0, 0, 0, 0, 0, 2]
|
expected_content = [3, 2, 1, 0, 0, 0, 0, 0, 0, 2]
|
||||||
self.assertEqual(managed_domains_sliced_at_end_date, expected_content)
|
self.assertEqual(managed_domains_sliced_at_end_date, expected_content)
|
||||||
|
|
||||||
# Test without distinct
|
# Test without distinct
|
||||||
managed_domains_sliced_at_end_date = get_sliced_domains(filter_condition)
|
managed_domains_sliced_at_end_date = get_sliced_domains(filter_condition)
|
||||||
expected_content = [2, 4, 0, 0, 0, 0, 0, 0, 0, 2]
|
expected_content = [3, 4, 1, 0, 0, 0, 0, 0, 0, 2]
|
||||||
self.assertEqual(managed_domains_sliced_at_end_date, expected_content)
|
self.assertEqual(managed_domains_sliced_at_end_date, expected_content)
|
||||||
|
|
||||||
def test_get_sliced_requests(self):
|
def test_get_sliced_requests(self):
|
||||||
|
|
|
@ -80,7 +80,7 @@ def parse_domain_row(columns, domain_info: DomainInformation, security_emails_di
|
||||||
if security_email.lower() in invalid_emails:
|
if security_email.lower() in invalid_emails:
|
||||||
security_email = "(blank)"
|
security_email = "(blank)"
|
||||||
|
|
||||||
if domain_info.federal_type:
|
if domain_info.federal_type and domain_info.generic_org_type == "federal":
|
||||||
domain_type = f"{domain_info.get_generic_org_type_display()} - {domain_info.get_federal_type_display()}"
|
domain_type = f"{domain_info.get_generic_org_type_display()} - {domain_info.get_federal_type_display()}"
|
||||||
else:
|
else:
|
||||||
domain_type = domain_info.get_generic_org_type_display()
|
domain_type = domain_info.get_generic_org_type_display()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue