]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
list-objects: add basic tests for encoding 311/head
authorAbhishek Lekshmanan <abhishek@suse.com>
Fri, 18 Oct 2019 14:11:18 +0000 (16:11 +0200)
committerAbhishek Lekshmanan <abhishek@suse.com>
Fri, 18 Oct 2019 14:22:50 +0000 (16:22 +0200)
Fixes: https://tracker.ceph.com/issues/41870
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
s3tests_boto3/functional/test_s3.py

index 78f37338f4eb229cc2dd744bfd2c3a8456d383ee..6fec07183565af57bdda022d0efa74ab4ab7ec92 100644 (file)
@@ -228,6 +228,44 @@ def test_bucket_listv2_delimiter_basic():
     eq(len(prefixes), 2)
     eq(prefixes, ['foo/', 'quux/'])
 
+
+@attr(resource='bucket')
+@attr(method='get')
+@attr(operation='list')
+@attr(assertion='test url encoding')
+@attr('list-objects-v2')
+def test_bucket_listv2_encoding_basic():
+    bucket_name = _create_objects(keys=['foo+1/bar', 'foo/bar/xyzzy', 'quux ab/thud', 'asdf+b'])
+    client = get_client()
+
+    response = client.list_objects_v2(Bucket=bucket_name, Delimiter='/', EncodingType='url')
+    eq(response['Delimiter'], '/')
+    keys = _get_keys(response)
+    eq(keys, ['asdf%2Bb'])
+
+    prefixes = _get_prefixes(response)
+    eq(len(prefixes), 3)
+    eq(prefixes, ['foo%2B1/', 'foo/', 'quux%20ab/'])
+
+@attr(resource='bucket')
+@attr(method='get')
+@attr(operation='list')
+@attr(assertion='test url encoding')
+@attr('list-objects')
+def test_bucket_list_encoding_basic():
+    bucket_name = _create_objects(keys=['foo+1/bar', 'foo/bar/xyzzy', 'quux ab/thud', 'asdf+b'])
+    client = get_client()
+
+    response = client.list_objects(Bucket=bucket_name, Delimiter='/', EncodingType='url')
+    eq(response['Delimiter'], '/')
+    keys = _get_keys(response)
+    eq(keys, ['asdf%2Bb'])
+
+    prefixes = _get_prefixes(response)
+    eq(len(prefixes), 3)
+    eq(prefixes, ['foo%2B1/', 'foo/', 'quux%20ab/'])
+
+
 def validate_bucket_list(bucket_name, prefix, delimiter, marker, max_keys,
                          is_truncated, check_objs, check_prefixes, next_marker):
     client = get_client()