Skip to content

Commit

Permalink
Fix failing test due to extra , which made argument a tuple, fix lint
Browse files Browse the repository at this point in the history
and reformat the code.
  • Loading branch information
Kami committed Jul 31, 2023
1 parent 70d2f56 commit 0450ac4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
11 changes: 10 additions & 1 deletion libcloud/storage/drivers/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 6 additions & 2 deletions libcloud/test/storage/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0450ac4

Please sign in to comment.