Skip to content

Commit

Permalink
bugfix: param name + add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Totalus committed Sep 6, 2022
1 parent afee402 commit 01ab233
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ObjectStorageClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def upload_file(self, localFilePath: str, object_name: str, metadata: dict={}, c
"""Upload a file with, optionally specifying some metadata to apply to the object"""
with open(localFilePath, 'rb') as file:
ok = self.object_upload(
file=file,
stream=file,
object_name=object_name,
metadata=metadata,
container_name=container_name
Expand Down
12 changes: 12 additions & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,19 @@ def test_suite_v2(self):
self.assertEqual(downloaded_data.getvalue(), data.getvalue(), 'object_download() should download the same data that was uploaded with object_upload()')

# Upload a file
print(f'Uploading file')
filename = random_string() + '.txt'
with open(filename, 'w') as f:
f.write(random_string(100))

self.assertTrue(client.upload_file(localFilePath=filename, object_name=filename))
self.assertIsNotNone(client.object_info(filename))
os.remove(filename)

# Download a file
print(f'Downloading file')
self.assertTrue(client.download_file(outputFilePath=filename, object_name=filename))
os.remove(filename)

# Delete container
self.assertFalse(client.container_delete(container_name), 'container_delete() should not delete a container that is not empty')
Expand Down

0 comments on commit 01ab233

Please sign in to comment.