formatted for code readability

This commit is contained in:
David Kennedy 2024-06-14 12:32:17 -04:00
parent aa0a398c06
commit 38f7ef50db
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
3 changed files with 14 additions and 9 deletions

View file

@ -1,4 +1,3 @@
import glob
import logging
import math
import os
@ -92,7 +91,7 @@ class Command(BaseCommand):
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")
except Exception as e:
logger.error(f"Failed to export {table_name}: {e}")

View file

@ -1,5 +1,4 @@
import argparse
import glob
import logging
import os
import pyzipper
@ -75,7 +74,6 @@ class Command(BaseCommand):
# Define the directory and the pattern for csv filenames
tmp_dir = "tmp"
#pattern = os.path.join(tmp_dir, f"{table_name}_*.csv")
pattern = f"{table_name}_"
resourceclass = getattr(registrar.admin, resourcename)

View file

@ -870,8 +870,6 @@ class TestCleanTables(TestCase):
self.logger_mock.error.assert_any_call("Error cleaning table DomainInformation: Some error")
class TestExportTables(MockEppLib):
"""Test the export_tables script"""
@ -902,8 +900,18 @@ class TestExportTables(MockEppLib):
# Check that the export_table function was called for each table
table_names = [
"User", "Contact", "Domain", "DomainRequest", "DomainInformation", "FederalAgency",
"UserDomainRole", "DraftDomain", "Website", "HostIp", "Host", "PublicContact",
"User",
"Contact",
"Domain",
"DomainRequest",
"DomainInformation",
"FederalAgency",
"UserDomainRole",
"DraftDomain",
"Website",
"HostIp",
"Host",
"PublicContact",
]
# Mock directory listing
@ -1025,7 +1033,7 @@ class TestImportTables(TestCase):
"Host",
"PublicContact",
]
# Mock directory listing
mock_listdir.side_effect = lambda path: [f"{table}_1.csv" for table in table_names]