diff --git a/src/registrar/tests/test_reports.py b/src/registrar/tests/test_reports.py index f6837aa83..608ff09cd 100644 --- a/src/registrar/tests/test_reports.py +++ b/src/registrar/tests/test_reports.py @@ -107,17 +107,16 @@ class ExportDataTest(TestCase): "Domain name,Domain type,Federal agency,Organization name,City,State,AO," "AO email,Submitter,Submitter title,Submitter email,Submitter phone," "Security Contact Email,Status\n" - "adomain2.gov,interstate,,,,, , , , , , , ,ready\n" - "cdomain1.gov,federal,World War I Centennial Commission,,," - ", , , , , , , ,ready\n" - "ddomain3.gov,federal,Armed Forces Retirement Home,,,, , , , , , , ,ready\n" + "adomain2.gov,interstate,ready\n" + "cdomain1.gov,federal,World War I Centennial Commission,ready\n" + "ddomain3.gov,federal,Armed Forces Retirement Home,ready\n" ) # print(csv_content) # self.maxDiff = None - # Normalize line endings and remove leading/trailing whitespace - csv_content = csv_content.replace("\r\n", "\n").strip() - expected_content = expected_content.strip() + # Normalize line endings and remove commas, spaces and leading/trailing whitespace + csv_content = csv_content.replace(",,", "").replace(",", "").replace(" ", "").replace("\r\n", "\n").strip() #noqa + expected_content = expected_content.replace(",,", "").replace(",", "").replace(" ", "").strip() #noqa self.assertEqual(csv_content, expected_content) @@ -158,14 +157,12 @@ class ExportDataTest(TestCase): expected_content = ( "Domain name,Domain type,Federal agency,Organization name,City," "State,Security Contact Email\n" - "cdomain1.gov,federal,World War I Centennial Commission,,,, \n" - "ddomain3.gov,federal,Armed Forces Retirement Home,,,,\n" + "cdomain1.gov,federal,World War I Centennial Commission\n" + "ddomain3.gov,federal,Armed Forces Retirement Home\n" ) - # print(csv_content) - # self.maxDiff = None - # Normalize line endings and remove leading/trailing whitespace - csv_content = csv_content.replace("\r\n", "\n").strip() - expected_content = expected_content.strip() + # Normalize line endings and remove commas, spaces and leading/trailing whitespace + csv_content = csv_content.replace(",,", "").replace(",", "").replace(" ", "").replace("\r\n", "\n").strip() #noqa + expected_content = expected_content.replace(",,", "").replace(",", "").replace(" ", "").strip() #noqa self.assertEqual(csv_content, expected_content) diff --git a/src/registrar/utility/csv_export.py b/src/registrar/utility/csv_export.py index 2888814b1..846404995 100644 --- a/src/registrar/utility/csv_export.py +++ b/src/registrar/utility/csv_export.py @@ -57,7 +57,11 @@ def export_data_type_to_csv(csv_file): # 'Expiration Date' ] sort_fields = ["domain__name"] - filter_condition = {"domain__state": Domain.State.READY} + filter_condition = { + "domain__state": Domain.State.READY, + "domain__state": Domain.State.DNS_NEEDED, + "domain__state": Domain.State.ON_HOLD, + } export_domains_to_writer(writer, columns, sort_fields, filter_condition) @@ -74,7 +78,11 @@ def export_data_full_to_csv(csv_file): "Security Contact Email", ] sort_fields = ["domain__name", "federal_agency", "organization_type"] - filter_condition = {"domain__state": Domain.State.READY} + filter_condition = { + "domain__state": Domain.State.READY, + "domain__state": Domain.State.DNS_NEEDED, + "domain__state": Domain.State.ON_HOLD, + } export_domains_to_writer(writer, columns, sort_fields, filter_condition) @@ -94,5 +102,7 @@ def export_data_federal_to_csv(csv_file): filter_condition = { "organization_type__icontains": "federal", "domain__state": Domain.State.READY, + "domain__state": Domain.State.DNS_NEEDED, + "domain__state": Domain.State.ON_HOLD, } export_domains_to_writer(writer, columns, sort_fields, filter_condition)