mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-20 01:36:00 +02:00
formatted for code readability
This commit is contained in:
parent
aa0a398c06
commit
38f7ef50db
3 changed files with 14 additions and 9 deletions
|
@ -1,4 +1,3 @@
|
||||||
import glob
|
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
|
@ -92,7 +91,7 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
logger.info(f"Successfully exported {table_name} into {num_files} files.")
|
logger.info(f"Successfully exported {table_name} into {num_files} files.")
|
||||||
|
|
||||||
except AttributeError as ae:
|
except AttributeError:
|
||||||
logger.error(f"Resource class {resourcename} not found in registrar.admin")
|
logger.error(f"Resource class {resourcename} not found in registrar.admin")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to export {table_name}: {e}")
|
logger.error(f"Failed to export {table_name}: {e}")
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import argparse
|
import argparse
|
||||||
import glob
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import pyzipper
|
import pyzipper
|
||||||
|
@ -75,7 +74,6 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
# Define the directory and the pattern for csv filenames
|
# Define the directory and the pattern for csv filenames
|
||||||
tmp_dir = "tmp"
|
tmp_dir = "tmp"
|
||||||
#pattern = os.path.join(tmp_dir, f"{table_name}_*.csv")
|
|
||||||
pattern = f"{table_name}_"
|
pattern = f"{table_name}_"
|
||||||
|
|
||||||
resourceclass = getattr(registrar.admin, resourcename)
|
resourceclass = getattr(registrar.admin, resourcename)
|
||||||
|
|
|
@ -870,8 +870,6 @@ class TestCleanTables(TestCase):
|
||||||
self.logger_mock.error.assert_any_call("Error cleaning table DomainInformation: Some error")
|
self.logger_mock.error.assert_any_call("Error cleaning table DomainInformation: Some error")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TestExportTables(MockEppLib):
|
class TestExportTables(MockEppLib):
|
||||||
"""Test the export_tables script"""
|
"""Test the export_tables script"""
|
||||||
|
|
||||||
|
@ -902,8 +900,18 @@ class TestExportTables(MockEppLib):
|
||||||
|
|
||||||
# Check that the export_table function was called for each table
|
# Check that the export_table function was called for each table
|
||||||
table_names = [
|
table_names = [
|
||||||
"User", "Contact", "Domain", "DomainRequest", "DomainInformation", "FederalAgency",
|
"User",
|
||||||
"UserDomainRole", "DraftDomain", "Website", "HostIp", "Host", "PublicContact",
|
"Contact",
|
||||||
|
"Domain",
|
||||||
|
"DomainRequest",
|
||||||
|
"DomainInformation",
|
||||||
|
"FederalAgency",
|
||||||
|
"UserDomainRole",
|
||||||
|
"DraftDomain",
|
||||||
|
"Website",
|
||||||
|
"HostIp",
|
||||||
|
"Host",
|
||||||
|
"PublicContact",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Mock directory listing
|
# Mock directory listing
|
||||||
|
@ -1025,7 +1033,7 @@ class TestImportTables(TestCase):
|
||||||
"Host",
|
"Host",
|
||||||
"PublicContact",
|
"PublicContact",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Mock directory listing
|
# Mock directory listing
|
||||||
mock_listdir.side_effect = lambda path: [f"{table}_1.csv" for table in table_names]
|
mock_listdir.side_effect = lambda path: [f"{table}_1.csv" for table in table_names]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue