Skip to content

Commit 64c8837

Browse files
committed
testing: 增加put_object单元测试
1 parent 4394a33 commit 64c8837

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/test_cos_api_object.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ def test_put_object(self):
4949
self.assertEqual(200, response.status_code)
5050
self.assertTrue(response.hash_crc64ecma > 0)
5151

52+
def test_put_object_with_file(self):
53+
local_file_path = './test.txt'
54+
with open(local_file_path, 'wb') as f:
55+
f.write(b'test')
56+
response = self.client.put_object(object_key='qcloud_sdk/fake-key', data=open(local_file_path, 'rb'))
57+
self.assertEqual(200, response.status_code)
58+
os.remove(local_file_path)
59+
5260
def test_put_object_with_no_content(self):
5361
response = self.client.put_object(object_key='qcloud_sdk/fake-key')
5462
self.assertEqual(200, response.status_code)

0 commit comments

Comments
 (0)