mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-05 17:28:31 +02:00
Remove transition domain tests and comments
This commit is contained in:
parent
c3a52d983c
commit
6ef4f4b1c9
3 changed files with 0 additions and 147 deletions
|
@ -552,83 +552,6 @@ class TestPatchAgencyInfo(TestCase):
|
|||
with less_console_noise():
|
||||
call_command("patch_federal_agency_info", "registrar/tests/data/fake_current_full.csv", debug=True)
|
||||
|
||||
def test_patch_agency_info(self):
|
||||
"""
|
||||
Tests that the `patch_federal_agency_info` command successfully
|
||||
updates the `federal_agency` field
|
||||
of a `DomainInformation` object when the corresponding
|
||||
`TransitionDomain` object has a valid `federal_agency`.
|
||||
"""
|
||||
with less_console_noise():
|
||||
# Ensure that the federal_agency is None
|
||||
self.assertEqual(self.domain_info.federal_agency, None)
|
||||
self.call_patch_federal_agency_info()
|
||||
# Reload the domain_info object from the database
|
||||
self.domain_info.refresh_from_db()
|
||||
# Check that the federal_agency field was updated
|
||||
federal_agency, _ = FederalAgency.objects.get_or_create(agency="test agency")
|
||||
self.assertEqual(self.domain_info.federal_agency.agency, "test agency")
|
||||
|
||||
def test_patch_agency_info_skip(self):
|
||||
"""
|
||||
Tests that the `patch_federal_agency_info` command logs a warning and
|
||||
does not update the `federal_agency` field
|
||||
of a `DomainInformation` object when the corresponding
|
||||
`TransitionDomain` object does not exist.
|
||||
"""
|
||||
with less_console_noise():
|
||||
# Set federal_agency to None to simulate a skip
|
||||
self.transition_domain.federal_agency = None
|
||||
self.transition_domain.save()
|
||||
with self.assertLogs("registrar.management.commands.patch_federal_agency_info", level="WARNING") as context:
|
||||
self.call_patch_federal_agency_info()
|
||||
# Check that the correct log message was output
|
||||
self.assertIn("SOME AGENCY DATA WAS NONE", context.output[0])
|
||||
# Reload the domain_info object from the database
|
||||
self.domain_info.refresh_from_db()
|
||||
# Check that the federal_agency field was not updated
|
||||
self.assertIsNone(self.domain_info.federal_agency)
|
||||
|
||||
def test_patch_agency_info_skip_updates_data(self):
|
||||
"""
|
||||
Tests that the `patch_federal_agency_info` command logs a warning but
|
||||
updates the DomainInformation object, because a record exists in the
|
||||
provided current-full.csv file.
|
||||
"""
|
||||
with less_console_noise():
|
||||
# Set federal_agency to None to simulate a skip
|
||||
self.transition_domain.federal_agency = None
|
||||
self.transition_domain.save()
|
||||
# Change the domain name to something parsable in the .csv
|
||||
self.domain.name = "cdomain1.gov"
|
||||
self.domain.save()
|
||||
with self.assertLogs("registrar.management.commands.patch_federal_agency_info", level="WARNING") as context:
|
||||
self.call_patch_federal_agency_info()
|
||||
# Check that the correct log message was output
|
||||
self.assertIn("SOME AGENCY DATA WAS NONE", context.output[0])
|
||||
# Reload the domain_info object from the database
|
||||
self.domain_info.refresh_from_db()
|
||||
# Check that the federal_agency field was not updated
|
||||
self.assertEqual(self.domain_info.federal_agency, "World War I Centennial Commission")
|
||||
|
||||
def test_patch_agency_info_skips_valid_domains(self):
|
||||
"""
|
||||
Tests that the `patch_federal_agency_info` command logs INFO and
|
||||
does not update the `federal_agency` field
|
||||
of a `DomainInformation` object
|
||||
"""
|
||||
with less_console_noise():
|
||||
self.domain_info.federal_agency = "unchanged"
|
||||
self.domain_info.save()
|
||||
with self.assertLogs("registrar.management.commands.patch_federal_agency_info", level="INFO") as context:
|
||||
self.call_patch_federal_agency_info()
|
||||
# Check that the correct log message was output
|
||||
self.assertIn("FINISHED", context.output[1])
|
||||
# Reload the domain_info object from the database
|
||||
self.domain_info.refresh_from_db()
|
||||
# Check that the federal_agency field was not updated
|
||||
self.assertEqual(self.domain_info.federal_agency, "unchanged")
|
||||
|
||||
|
||||
class TestExtendExpirationDates(MockEppLib):
|
||||
def setUp(self):
|
||||
|
|
|
@ -763,74 +763,6 @@ class TestMigrations(TestCase):
|
|||
self.assertEqual(testdomain.name, "fakewebsite2.gov")
|
||||
self.assertEqual(testdomain.state, "on hold")
|
||||
|
||||
def test_load_full_domain_information(self):
|
||||
with less_console_noise():
|
||||
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,
|
||||
)
|
||||
|
||||
# Test created Domain Information objects
|
||||
domain = Domain.objects.filter(name="anomaly.gov").get()
|
||||
anomaly_domain_infos = DomainInformation.objects.filter(domain=domain)
|
||||
|
||||
self.assertEqual(anomaly_domain_infos.count(), 1)
|
||||
|
||||
# This domain should be pretty barebones. Something isnt
|
||||
# parsing right if we get a lot of data.
|
||||
anomaly = anomaly_domain_infos.get()
|
||||
self.assertEqual(anomaly.organization_name, "Flashdog")
|
||||
self.assertEqual(anomaly.generic_org_type, None)
|
||||
self.assertEqual(anomaly.federal_agency, None)
|
||||
self.assertEqual(anomaly.federal_type, None)
|
||||
|
||||
# Check for the "system" creator user
|
||||
Users = User.objects.filter(username="System")
|
||||
self.assertEqual(Users.count(), 1)
|
||||
self.assertEqual(anomaly.creator, Users.get())
|
||||
|
||||
domain = Domain.objects.filter(name="fakewebsite2.gov").get()
|
||||
fakewebsite_domain_infos = DomainInformation.objects.filter(domain=domain)
|
||||
self.assertEqual(fakewebsite_domain_infos.count(), 1)
|
||||
|
||||
fakewebsite = fakewebsite_domain_infos.get()
|
||||
self.assertEqual(fakewebsite.organization_name, "Fanoodle")
|
||||
self.assertEqual(fakewebsite.generic_org_type, "federal")
|
||||
self.assertEqual(fakewebsite.federal_agency.agency, "Department of Commerce")
|
||||
self.assertEqual(fakewebsite.federal_type, "executive")
|
||||
|
||||
ao = fakewebsite.authorizing_official
|
||||
|
||||
self.assertEqual(ao.first_name, "Seline")
|
||||
self.assertEqual(ao.middle_name, "testmiddle2")
|
||||
self.assertEqual(ao.last_name, "Tower")
|
||||
self.assertEqual(ao.email, "stower3@answers.com")
|
||||
self.assertEqual(ao.phone, "151-539-6028")
|
||||
|
||||
# Check for the "system" creator user
|
||||
Users = User.objects.filter(username="System")
|
||||
self.assertEqual(Users.count(), 1)
|
||||
self.assertEqual(anomaly.creator, Users.get())
|
||||
|
||||
def test_transfer_transition_domains_to_domains(self):
|
||||
with less_console_noise():
|
||||
self.run_load_domains()
|
||||
|
|
|
@ -1457,8 +1457,6 @@ class TestDomainOrganization(TestDomainOverview):
|
|||
self.assertEqual(success_result_page.status_code, 200)
|
||||
|
||||
# Check for the old and new value
|
||||
# print("!!! SUCCESS_RESULT_PAGE IS", success_result_page)
|
||||
# TODO: Check for "selected" instead of id
|
||||
self.assertContains(success_result_page, federal_agency.id)
|
||||
self.assertNotContains(success_result_page, "Department of State")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue