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 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}")

View file

@ -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)

View file

@ -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