diff --git a/src/registrar/management/commands/export_tables.py b/src/registrar/management/commands/export_tables.py index e5c940a40..d9b45ec94 100644 --- a/src/registrar/management/commands/export_tables.py +++ b/src/registrar/management/commands/export_tables.py @@ -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}") diff --git a/src/registrar/management/commands/import_tables.py b/src/registrar/management/commands/import_tables.py index abe26830f..7797d8d75 100644 --- a/src/registrar/management/commands/import_tables.py +++ b/src/registrar/management/commands/import_tables.py @@ -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) diff --git a/src/registrar/tests/test_management_scripts.py b/src/registrar/tests/test_management_scripts.py index 006a39231..8e3917d40 100644 --- a/src/registrar/tests/test_management_scripts.py +++ b/src/registrar/tests/test_management_scripts.py @@ -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]