mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-30 17:23:55 +02:00
More tests
This commit is contained in:
parent
f7d906245e
commit
6df045673d
3 changed files with 69 additions and 17 deletions
|
@ -518,7 +518,6 @@ class LoadExtraTransitionDomain:
|
|||
"""Grabs a corresponding row within the DOMAIN_ADDITIONAL file,
|
||||
based off a desired_id"""
|
||||
l = self.get_object_by_id(EnumFilenames.DOMAIN_ADDITIONAL, desired_id.lower())
|
||||
print(f"is it happening here? {l} for id {desired_id}")
|
||||
return self.get_object_by_id(EnumFilenames.DOMAIN_ADDITIONAL, desired_id)
|
||||
|
||||
def get_organization_adhoc(self, desired_id) -> OrganizationAdhoc:
|
||||
|
|
|
@ -79,20 +79,6 @@ class TransitionDomain(TimeStampedModel):
|
|||
)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
return f"""
|
||||
username="{self.username}",
|
||||
domain_name="{self.domain_name}",
|
||||
status="{self.status}",
|
||||
email_sent={self.email_sent},
|
||||
organization_type="{self.organization_type}",
|
||||
organization_name="{self.organization_name}",
|
||||
federal_type="{self.federal_type}",
|
||||
federal_agency="{self.federal_agency}",
|
||||
epp_creation_date={self.epp_creation_date},
|
||||
epp_expiration_date={self.epp_expiration_date}
|
||||
"""
|
||||
"""
|
||||
return (
|
||||
f"\n-----TRANSITION DOMAIN------\n"
|
||||
f"domainName: {self.domain_name}, \n"
|
||||
|
@ -105,4 +91,4 @@ class TransitionDomain(TimeStampedModel):
|
|||
f"federal_agency: {self.federal_agency}, \n"
|
||||
f"epp_creation_date: {self.epp_creation_date}, \n"
|
||||
f"epp_expiration_date: {self.epp_expiration_date}, \n"
|
||||
)"""
|
||||
)
|
||||
|
|
|
@ -367,8 +367,75 @@ class TestMigrations(TestCase):
|
|||
# Each TransitionDomain should have the correct data
|
||||
self.assertEqual(domain, expected)
|
||||
|
||||
def test_load_full_transfer_domain(self):
|
||||
self.run_load_domains()
|
||||
self.run_transfer_domains()
|
||||
|
||||
# Analyze the tables
|
||||
expected_total_transition_domains = 9
|
||||
expected_total_domains = 5
|
||||
expected_total_domain_informations = 5
|
||||
expected_total_domain_invitations = 8
|
||||
|
||||
expected_missing_domains = 0
|
||||
expected_duplicate_domains = 0
|
||||
expected_missing_domain_informations = 0
|
||||
expected_missing_domain_invitations = 1
|
||||
self.compare_tables(
|
||||
expected_total_transition_domains,
|
||||
expected_total_domains,
|
||||
expected_total_domain_informations,
|
||||
expected_total_domain_invitations,
|
||||
expected_missing_domains,
|
||||
expected_duplicate_domains,
|
||||
expected_missing_domain_informations,
|
||||
expected_missing_domain_invitations,
|
||||
)
|
||||
|
||||
expected_domains = [
|
||||
Domain(
|
||||
expiration_date=None,
|
||||
name="anomaly.gov",
|
||||
state="ready",
|
||||
),
|
||||
Domain(
|
||||
expiration_date=None,
|
||||
name="testdomain.gov",
|
||||
state="ready",
|
||||
),
|
||||
Domain(
|
||||
expiration_date=None,
|
||||
name="fakewebsite1.gov",
|
||||
state="on hold",
|
||||
),
|
||||
Domain(
|
||||
expiration_date=None,
|
||||
name="fakewebsite2.gov",
|
||||
state="on hold",
|
||||
),
|
||||
Domain(
|
||||
expiration_date=None,
|
||||
name="fakewebsite3.gov",
|
||||
state="ready",
|
||||
),
|
||||
]
|
||||
|
||||
for domain in Domain.objects.all():
|
||||
print(f"""
|
||||
Domain(
|
||||
expiration_date={domain.expiration_date},
|
||||
name="{domain.name}",
|
||||
state="{domain.state}",
|
||||
),
|
||||
"""
|
||||
)
|
||||
for expected in expected_domains:
|
||||
expected.id = domain.id
|
||||
expected.created_at = domain.created_at
|
||||
expected.updated_at = domain.updated_at
|
||||
self.assertEqual(domain, expected)
|
||||
|
||||
def test_transfer_transition_domains_to_domains(self):
|
||||
# TODO: setup manually instead of calling other script
|
||||
self.run_load_domains()
|
||||
self.run_transfer_domains()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue