This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit 8752aa52320574a96fc11a0ce71c12054910e86f
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Tue Aug 1 12:27:39 2023 +0200

    Add a test case for specifying metadata when uploading an object in the
    Backblaze B2 driver.
---
 libcloud/test/storage/test_backblaze_b2.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libcloud/test/storage/test_backblaze_b2.py 
b/libcloud/test/storage/test_backblaze_b2.py
index 2ec0dad24..d2b3d6731 100644
--- a/libcloud/test/storage/test_backblaze_b2.py
+++ b/libcloud/test/storage/test_backblaze_b2.py
@@ -123,6 +123,17 @@ class BackblazeB2StorageDriverTestCase(unittest.TestCase):
         self.assertEqual(obj.size, 24)
         self.assertEqual(obj.extra["fileId"], "abcde")
 
+    def test_upload_object_with_metadata(self):
+        file_path = os.path.abspath(__file__)
+        container = self.driver.list_containers()[0]
+        obj = self.driver.upload_object(
+            file_path=file_path, container=container, 
object_name="test0007.txt",
+            extra={"meta_data": {"foo": "bar", "baz": 1}}
+        )
+        self.assertEqual(obj.name, "test0007.txt")
+        self.assertEqual(obj.size, 24)
+        self.assertEqual(obj.extra["fileId"], "abcde")
+
     def test_delete_object(self):
         container = self.driver.list_containers()[0]
         obj = self.driver.list_container_objects(container=container)[0]

Reply via email to