From 2a0afe0d4b6e2ed31f95e331504b96e235127760 Mon Sep 17 00:00:00 2001 From: Julien Boulanger Date: Wed, 20 Dec 2023 17:55:51 +0100 Subject: [PATCH] chore: rollback fmt --- medusa/storage/s3_base_storage.py | 1 - tests/storage/s3_storage_test.py | 54 +++++++++++++++---------------- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/medusa/storage/s3_base_storage.py b/medusa/storage/s3_base_storage.py index 5da0324b..818b37bd 100644 --- a/medusa/storage/s3_base_storage.py +++ b/medusa/storage/s3_base_storage.py @@ -217,7 +217,6 @@ def _consolidate_credentials(config) -> CensoredCredentials: session.set_config_variable('credentials_file', config.key_file) boto_credentials = session.get_credentials() - return CensoredCredentials( access_key_id=boto_credentials.access_key, secret_access_key=boto_credentials.secret_key, diff --git a/tests/storage/s3_storage_test.py b/tests/storage/s3_storage_test.py index 363919eb..97dba176 100644 --- a/tests/storage/s3_storage_test.py +++ b/tests/storage/s3_storage_test.py @@ -62,16 +62,16 @@ def test_credentials_from_metadata(self): self.assertIsNone(os.environ.get("AWS_PROFILE", None)) config = AttributeDict({ - "api_profile": None, - "region": "region-from-config", - "storage_provider": "s3_us_west_oregon", - "key_file": empty_file.name, - "concurrent_transfers": "1", + 'api_profile': None, + 'region': 'region-from-config', + 'storage_provider': 's3_us_west_oregon', + 'key_file': empty_file.name, + 'concurrent_transfers': '1', }) credentials = S3BaseStorage._consolidate_credentials(config) - self.assertEqual("key-from-instance-metadata", credentials.access_key_id) - self.assertEqual("region-from-config", credentials.region) + self.assertEqual('key-from-instance-metadata', credentials.access_key_id) + self.assertEqual('region-from-config', credentials.region) def test_credentials_from_env_without_profile(self): with tempfile.NamedTemporaryFile() as empty_file: @@ -80,19 +80,19 @@ def test_credentials_from_env_without_profile(self): os.environ["AWS_SECRET_ACCESS_KEY"] = "secret-from-env" config = AttributeDict({ - "api_profile": None, - "region": "region-from-config", - "storage_provider": "s3_us_west_oregon", - "key_file": empty_file.name, - "concurrent_transfers": "1", - }) + 'api_profile': None, + 'region': 'region-from-config', + 'storage_provider': 's3_us_west_oregon', + 'key_file': empty_file.name, + 'concurrent_transfers': '1' + }) credentials = S3BaseStorage._consolidate_credentials(config) - self.assertEqual("key-from-env", credentials.access_key_id) - self.assertEqual("region-from-config", credentials.region) + self.assertEqual('key-from-env', credentials.access_key_id) + self.assertEqual('region-from-config', credentials.region) - del os.environ["AWS_ACCESS_KEY_ID"] - del os.environ["AWS_SECRET_ACCESS_KEY"] + del os.environ['AWS_ACCESS_KEY_ID'] + del os.environ['AWS_SECRET_ACCESS_KEY'] def test_credentials_from_file(self): credentials_file_content = """ @@ -108,19 +108,17 @@ def test_credentials_from_file(self): self.assertIsNone(os.environ.get("AWS_ACCESS_KEY_ID", None)) self.assertIsNone(os.environ.get("AWS_SECRET_ACCESS_KEY", None)) - config = AttributeDict( - { - "api_profile": "default", - "region": "region-from-config", - "storage_provider": "s3_us_west_oregon", - "key_file": credentials_file.name, - "concurrent_transfers": "1", - } - ) + config = AttributeDict({ + 'api_profile': 'default', + 'region': 'region-from-config', + 'storage_provider': 's3_us_west_oregon', + 'key_file': credentials_file.name, + 'concurrent_transfers': '1' + }) credentials = S3BaseStorage._consolidate_credentials(config) - self.assertEqual("key-from-file", credentials.access_key_id) - self.assertEqual("region-from-config", credentials.region) + self.assertEqual('key-from-file', credentials.access_key_id) + self.assertEqual('region-from-config', credentials.region) def test_credentials_from_everything(self): credentials_file_content = """