Skip to content

Commit

Permalink
SDK/python: Add test for invalid bucket name
Browse files Browse the repository at this point in the history
Signed-off-by: Soumyendra Shrivastava <[email protected]>
  • Loading branch information
soumyendra98 committed Mar 8, 2024
1 parent 76946a7 commit b3e4e81
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions python/tests/integration/sdk/remote_enabled_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import boto3

from aistore.sdk.const import PROVIDER_AIS

from aistore import Client
from tests.integration import (
REMOTE_SET,
Expand Down Expand Up @@ -68,8 +67,8 @@ def _create_bucket(self, bck_name, provider=PROVIDER_AIS):
provider: Provider for new bucket
"""
bck = self.client.bucket(bck_name, provider=provider)
self.buckets.append(bck_name)
bck.create()
self.buckets.append(bck_name)
return bck

def _create_objects(self, num_obj=OBJECT_COUNT, suffix=""):
Expand Down
7 changes: 7 additions & 0 deletions python/tests/integration/sdk/test_bucket_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ def test_bucket(self):
bucket_names = {bck.name for bck in res}
self.assertIn(new_bck_name, bucket_names)

@test_cases(
"*", ".", "", " ", "bucket/name", "bucket and name", "#name", "$name", "~name"
)
def test_create_bucket_invalid_name(self, testcase):
with self.assertRaises(AISError):
self._create_bucket(testcase)

def test_bucket_invalid_name(self):
with self.assertRaises(ErrBckNotFound):
self.client.bucket("INVALID_BCK_NAME").list_objects()
Expand Down

0 comments on commit b3e4e81

Please sign in to comment.