mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-30 17:23:55 +02:00
Finish test / Add debug flag
This commit is contained in:
parent
44c7631eaa
commit
f7d906245e
2 changed files with 122 additions and 19 deletions
|
@ -136,7 +136,7 @@ class LoadExtraTransitionDomain:
|
|||
def __init__(self, options: TransitionDomainArguments):
|
||||
# Globally stores event logs and organizes them
|
||||
self.parse_logs = FileTransitionLog()
|
||||
print(f"options correct? {options.agency_adhoc_filename}")
|
||||
self.debug = options.debug
|
||||
# Reads and parses migration files
|
||||
self.parsed_data_container = ExtraTransitionDomain(options)
|
||||
self.parsed_data_container.parse_all_files(options.infer_filenames)
|
||||
|
@ -178,7 +178,8 @@ class LoadExtraTransitionDomain:
|
|||
#if updated_transition_domain.__dict__ != transition_domain.__dict__:
|
||||
updated_transition_domain.save()
|
||||
updated_transition_domains.append(updated_transition_domain)
|
||||
|
||||
if self.debug:
|
||||
# Display errors for this specific domain
|
||||
self.parse_logs.display_logs_by_domain_name(domain_name)
|
||||
logger.info(
|
||||
f"{TerminalColors.OKCYAN}"
|
||||
|
@ -198,6 +199,10 @@ class LoadExtraTransitionDomain:
|
|||
)
|
||||
failed_transition_domains.append(domain_name)
|
||||
|
||||
if self.debug:
|
||||
# Display misc errors (not associated to a domain)
|
||||
self.parse_logs.display_logs_by_domain_name(None)
|
||||
|
||||
failed_count = len(failed_transition_domains)
|
||||
if failed_count == 0:
|
||||
logger.info(
|
||||
|
|
|
@ -168,7 +168,7 @@ class TestMigrations(TestCase):
|
|||
|
||||
# STEP 2: (analyze the tables just like the
|
||||
# migration script does, but add assert statements)
|
||||
expected_total_transition_domains = 8
|
||||
expected_total_transition_domains = 9
|
||||
expected_total_domains = 4
|
||||
expected_total_domain_informations = 4
|
||||
expected_total_domain_invitations = 7
|
||||
|
@ -195,7 +195,7 @@ class TestMigrations(TestCase):
|
|||
|
||||
# STEP 2: (analyze the tables just like the migration
|
||||
# script does, but add assert statements)
|
||||
expected_total_transition_domains = 8
|
||||
expected_total_transition_domains = 9
|
||||
expected_total_domains = 0
|
||||
expected_total_domain_informations = 0
|
||||
expected_total_domain_invitations = 0
|
||||
|
@ -221,15 +221,15 @@ class TestMigrations(TestCase):
|
|||
|
||||
# We should get a consistent number
|
||||
# of records
|
||||
expected_total_transition_domains = 8
|
||||
expected_total_transition_domains = 9
|
||||
expected_total_domains = 0
|
||||
expected_total_domain_informations = 0
|
||||
expected_total_domain_invitations = 0
|
||||
|
||||
expected_missing_domains = 8
|
||||
expected_missing_domains = 9
|
||||
expected_duplicate_domains = 0
|
||||
expected_missing_domain_informations = 8
|
||||
expected_missing_domain_invitations = 8
|
||||
expected_missing_domain_informations = 9
|
||||
expected_missing_domain_invitations = 9
|
||||
self.compare_tables(
|
||||
expected_total_transition_domains,
|
||||
expected_total_domains,
|
||||
|
@ -247,27 +247,125 @@ class TestMigrations(TestCase):
|
|||
domain_name="anomaly.gov",
|
||||
status="ready",
|
||||
email_sent=False,
|
||||
organization_type="None",
|
||||
organization_type=None,
|
||||
organization_name="Flashdog",
|
||||
federal_type="None",
|
||||
federal_agency="None",
|
||||
federal_type=None,
|
||||
federal_agency=None,
|
||||
epp_creation_date=None,
|
||||
epp_expiration_date=None
|
||||
),
|
||||
TransitionDomain(
|
||||
username="",
|
||||
domain_name="anomaly.gov",
|
||||
username="testuser@gmail.com",
|
||||
domain_name="testdomain.gov",
|
||||
status="ready",
|
||||
email_sent=False,
|
||||
organization_type="None",
|
||||
organization_name="Flashdog",
|
||||
federal_type="None",
|
||||
federal_agency="None",
|
||||
organization_type=None,
|
||||
organization_name="Gigaclub",
|
||||
federal_type=None,
|
||||
federal_agency=None,
|
||||
epp_creation_date=None,
|
||||
epp_expiration_date=None
|
||||
),
|
||||
TransitionDomain(
|
||||
username="agustina.wyman7@test.com",
|
||||
domain_name="fakewebsite1.gov",
|
||||
status="on hold",
|
||||
email_sent=False,
|
||||
organization_type=None,
|
||||
organization_name="Midel",
|
||||
federal_type=None,
|
||||
federal_agency=None,
|
||||
epp_creation_date=None,
|
||||
epp_expiration_date=None
|
||||
),
|
||||
TransitionDomain(
|
||||
username="susy.martin4@test.com",
|
||||
domain_name="fakewebsite1.gov",
|
||||
status="on hold",
|
||||
email_sent=False,
|
||||
organization_type=None,
|
||||
organization_name="Midel",
|
||||
federal_type=None,
|
||||
federal_agency=None,
|
||||
epp_creation_date=None,
|
||||
epp_expiration_date=None
|
||||
),
|
||||
TransitionDomain(
|
||||
username="stephania.winters4@test.com",
|
||||
domain_name="fakewebsite1.gov",
|
||||
status="on hold",
|
||||
email_sent=False,
|
||||
organization_type=None,
|
||||
organization_name="Midel",
|
||||
federal_type=None,
|
||||
federal_agency=None,
|
||||
epp_creation_date=None,
|
||||
epp_expiration_date=None
|
||||
),
|
||||
TransitionDomain(
|
||||
username="alexandra.bobbitt5@test.com",
|
||||
domain_name="fakewebsite2.gov",
|
||||
status="on hold",
|
||||
email_sent=False,
|
||||
organization_type="Federal",
|
||||
organization_name="Fanoodle",
|
||||
federal_type="Executive",
|
||||
federal_agency="InnoZ",
|
||||
epp_creation_date=None,
|
||||
epp_expiration_date=None
|
||||
),
|
||||
TransitionDomain(
|
||||
username="jospeh.mcdowell3@test.com",
|
||||
domain_name="fakewebsite2.gov",
|
||||
status="on hold",
|
||||
email_sent=False,
|
||||
organization_type="Federal",
|
||||
organization_name="Fanoodle",
|
||||
federal_type="Executive",
|
||||
federal_agency="InnoZ",
|
||||
epp_creation_date=None,
|
||||
epp_expiration_date=None
|
||||
),
|
||||
TransitionDomain(
|
||||
username="reginald.ratcliff4@test.com",
|
||||
domain_name="fakewebsite2.gov",
|
||||
status="on hold",
|
||||
email_sent=False,
|
||||
organization_type="Federal",
|
||||
organization_name="Fanoodle",
|
||||
federal_type="Executive",
|
||||
federal_agency="InnoZ",
|
||||
epp_creation_date=None,
|
||||
epp_expiration_date=None
|
||||
),
|
||||
TransitionDomain(
|
||||
username="reginald.ratcliff4@test.com",
|
||||
domain_name="fakewebsite3.gov",
|
||||
status="ready",
|
||||
email_sent=False,
|
||||
organization_type="City",
|
||||
organization_name="Sushi",
|
||||
federal_type=None,
|
||||
federal_agency=None,
|
||||
epp_creation_date=None,
|
||||
epp_expiration_date=None
|
||||
)
|
||||
]
|
||||
|
||||
# Afterwards, their values should be what we expect
|
||||
all_transition_domains = TransitionDomain.objects.all()
|
||||
for domain in all_transition_domains:
|
||||
for expected in expected_transition_domains:
|
||||
|
||||
# This data gets created when the object is,
|
||||
# so we should just match it. Not relevant
|
||||
# to the added data.
|
||||
expected.id = domain.id
|
||||
expected.created_at = domain.created_at
|
||||
expected.updated_at = domain.updated_at
|
||||
|
||||
# Each TransitionDomain should have the correct data
|
||||
self.assertEqual(domain, expected)
|
||||
|
||||
def test_transfer_transition_domains_to_domains(self):
|
||||
# TODO: setup manually instead of calling other script
|
||||
|
@ -275,7 +373,7 @@ class TestMigrations(TestCase):
|
|||
self.run_transfer_domains()
|
||||
|
||||
# Analyze the tables
|
||||
expected_total_transition_domains = 8
|
||||
expected_total_transition_domains = 9
|
||||
expected_total_domains = 4
|
||||
expected_total_domain_informations = 4
|
||||
expected_total_domain_invitations = 7
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue