From 0450ac42b2afeb366d9d1b380525d79f6c7d1a39 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Mon, 31 Jul 2023 11:46:07 +0200 Subject: [PATCH] Fix failing test due to extra , which made argument a tuple, fix lint and reformat the code. --- libcloud/storage/drivers/s3.py | 11 ++++++++++- libcloud/test/storage/test_s3.py | 8 ++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/libcloud/storage/drivers/s3.py b/libcloud/storage/drivers/s3.py index 3111d645b0..c17698a6b4 100644 --- a/libcloud/storage/drivers/s3.py +++ b/libcloud/storage/drivers/s3.py @@ -1107,7 +1107,16 @@ def _to_storage_class_headers(self, storage_class): """ headers = {} storage_class = storage_class or "standard" - if storage_class not in ["standard", "reduced_redundancy", "standard_ia", "onezone_ia", "intelligent_tiering", "glacier", "deep_archive", "glacier_ir"]: + if storage_class not in [ + "standard", + "reduced_redundancy", + "standard_ia", + "onezone_ia", + "intelligent_tiering", + "glacier", + "deep_archive", + "glacier_ir", + ]: raise ValueError("Invalid storage class value: %s" % (storage_class)) key = self.http_vendor_prefix + "-storage-class" diff --git a/libcloud/test/storage/test_s3.py b/libcloud/test/storage/test_s3.py index 27308322cb..6efd845ba6 100644 --- a/libcloud/test/storage/test_s3.py +++ b/libcloud/test/storage/test_s3.py @@ -1096,11 +1096,15 @@ def test_upload_small_object_with_glacier_ir(self): container = Container(name="foo_bar_container", extra={}, driver=self.driver) object_name = "foo_test_stream_data" - storage_class="glacier_ir", + storage_class = "glacier_ir" iterator = BytesIO(b("234")) extra = {"content_type": "text/plain"} obj = self.driver.upload_object_via_stream( - container=container, object_name=object_name, iterator=iterator, extra=extra, ex_storage_class=storage_class + container=container, + object_name=object_name, + iterator=iterator, + extra=extra, + ex_storage_class=storage_class, ) self.assertEqual(obj.name, object_name)