mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-20 17:56:11 +02:00
Normalize line endings and remove commas, spaces and leading/trailing whitespace
This commit is contained in:
parent
91420429c2
commit
87bdcb8263
2 changed files with 23 additions and 16 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue