mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-21 18:25:58 +02:00
Re-fix unit test
This commit is contained in:
parent
fc93415560
commit
822829da47
3 changed files with 21 additions and 14 deletions
|
@ -742,10 +742,14 @@ class MockDb(TestCase):
|
|||
status=DomainRequest.DomainRequestStatus.APPROVED,
|
||||
name="city5.gov",
|
||||
)
|
||||
self.domain_request_6 = completed_domain_request(
|
||||
status=DomainRequest.DomainRequestStatus.STARTED,
|
||||
name="city6.gov",
|
||||
)
|
||||
self.domain_request_3.submit()
|
||||
self.domain_request_4.submit()
|
||||
self.domain_request_6.submit()
|
||||
|
||||
self.domain_request_3.submission_date = get_time_aware_date(datetime(2024, 4, 2))
|
||||
other, _ = Contact.objects.get_or_create(
|
||||
first_name="Testy1232",
|
||||
last_name="Tester24",
|
||||
|
@ -764,20 +768,20 @@ class MockDb(TestCase):
|
|||
website_2, _ = Website.objects.get_or_create(website="cheeseville.gov")
|
||||
website_3, _ = Website.objects.get_or_create(website="https://www.example.com")
|
||||
website_4, _ = Website.objects.get_or_create(website="https://www.example2.com")
|
||||
self.domain_request_3.other_contacts.add(other)
|
||||
self.domain_request_3.save()
|
||||
self.domain_request_3.other_contacts.add(other_2)
|
||||
self.domain_request_3.save()
|
||||
self.domain_request_3.alternative_domains.add(website)
|
||||
self.domain_request_3.alternative_domains.add(website_2)
|
||||
|
||||
self.domain_request_3.other_contacts.add(other, other_2)
|
||||
self.domain_request_3.alternative_domains.add(website, website_2)
|
||||
self.domain_request_3.current_websites.add(website_3, website_4)
|
||||
self.domain_request_3.current_websites.add(website_4)
|
||||
self.domain_request_3.cisa_representative_email = "test@igorville.com"
|
||||
self.domain_request_3.submission_date = get_time_aware_date(datetime(2024, 4, 2))
|
||||
self.domain_request_3.save()
|
||||
|
||||
self.domain_request_4.submission_date = get_time_aware_date(datetime(2024, 4, 2))
|
||||
self.domain_request_4.save()
|
||||
|
||||
self.domain_request_6.submission_date = get_time_aware_date(datetime(2024, 4, 2))
|
||||
self.domain_request_6.save()
|
||||
|
||||
def tearDown(self):
|
||||
super().tearDown()
|
||||
PublicContact.objects.all().delete()
|
||||
|
|
|
@ -672,6 +672,7 @@ class ExportDataTest(MockDb, MockEppLib):
|
|||
columns = [
|
||||
"Domain request",
|
||||
"Domain type",
|
||||
"Federal type"
|
||||
]
|
||||
sort_fields = [
|
||||
"requested_domain__name",
|
||||
|
@ -696,7 +697,7 @@ class ExportDataTest(MockDb, MockEppLib):
|
|||
expected_content = (
|
||||
"Domain request,Domain type,Federal type\n"
|
||||
"city3.gov,Federal,Executive\n"
|
||||
"city4.gov,Federal,Executive\n"
|
||||
"city6.gov,Federal,Executive\n"
|
||||
)
|
||||
|
||||
# Normalize line endings and remove commas,
|
||||
|
@ -708,7 +709,7 @@ class ExportDataTest(MockDb, MockEppLib):
|
|||
|
||||
@less_console_noise_decorator
|
||||
def test_full_domain_request_report(self):
|
||||
""" """
|
||||
"""Tests the full domain request report."""
|
||||
|
||||
# Create a CSV file in memory
|
||||
csv_file = StringIO()
|
||||
|
@ -737,7 +738,7 @@ class ExportDataTest(MockDb, MockEppLib):
|
|||
csv_file.seek(0)
|
||||
# Read the content into a variable
|
||||
csv_content = csv_file.read()
|
||||
print(csv_content)
|
||||
|
||||
expected_content = (
|
||||
# Header
|
||||
"Domain request,Submitted at,Status,Domain type,Federal type,"
|
||||
|
@ -757,7 +758,9 @@ class ExportDataTest(MockDb, MockEppLib):
|
|||
" https://www.example2.com | https://www.example.com,\n"
|
||||
"city5.gov,,Approved,Federal,Executive,,Testorg,N/A,,NY,2,,,,1,0,"
|
||||
"city1.gov,Testy,Tester,testy@town.com,Chief Tester,Purpose of the site,There "
|
||||
"is more,Testy Tester testy2@town.com,,city.com,"
|
||||
"is more,Testy Tester testy2@town.com,,city.com,\n"
|
||||
"city6.gov,2024-04-02,Submitted,Federal,Executive,,Testorg,N/A,,NY,2,,,,0,1,city1.gov,Testy,Tester,"
|
||||
"testy@town.com,Chief Tester,Purpose of the site,There is more,Testy Tester testy2@town.com,,city.com,"
|
||||
)
|
||||
|
||||
# Normalize line endings and remove commas,
|
||||
|
@ -809,5 +812,5 @@ class HelperFunctions(MockDb):
|
|||
"submission_date__lte": self.end_date,
|
||||
}
|
||||
submitted_requests_sliced_at_end_date = get_sliced_requests(filter_condition)
|
||||
expected_content = [2, 2, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
expected_content = [2, 2, 0, 0, 0, 0, 0, 0, 0, 1]
|
||||
self.assertEqual(submitted_requests_sliced_at_end_date, expected_content)
|
||||
|
|
|
@ -816,7 +816,7 @@ class DomainRequestExport:
|
|||
# Annotations are custom columns returned to the queryset (AKA: computed in the DB).
|
||||
annotations = cls._full_domain_request_annotations()
|
||||
|
||||
# The .values returned from annotate_and_retrieve_fields can't go two levels deep
|
||||
# The .values returned from annotate_and_retrieve_fields can't go two levels deep
|
||||
# (just returns the field id of say, "creator") - so we have to include this.
|
||||
additional_values = [
|
||||
"requested_domain__name",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue