]> git.apps.os.sepia.ceph.com Git - s3-tests.git/commitdiff
s3: test list_buckets with MaxBuckets/ContinuationToken 679/head
authorCasey Bodley <cbodley@redhat.com>
Tue, 29 Jul 2025 14:59:20 +0000 (10:59 -0400)
committerCasey Bodley <cbodley@redhat.com>
Thu, 14 Aug 2025 14:29:06 +0000 (10:29 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
s3tests_boto3/functional/test_s3.py

index 92715521e18b672bace890a233d5221442f97d29..639dc7a25815cdb776e8c4799f12a2778225b99a 100644 (file)
@@ -5354,6 +5354,32 @@ def test_list_buckets_bad_auth():
     status, error_code = _get_status_and_error_code(e.response)
     assert status == 403
 
+def test_list_buckets_paginated():
+    client = get_client()
+
+    response = client.list_buckets(MaxBuckets=1)
+    assert len(response['Buckets']) == 0
+    assert 'ContinuationToken' not in response
+
+    bucket1 = get_new_bucket()
+
+    response = client.list_buckets(MaxBuckets=1)
+    assert len(response['Buckets']) == 1
+    assert response['Buckets'][0]['Name'] == bucket1
+    assert 'ContinuationToken' not in response
+
+    bucket2 = get_new_bucket()
+
+    response = client.list_buckets(MaxBuckets=1)
+    assert len(response['Buckets']) == 1
+    assert response['Buckets'][0]['Name'] == bucket1
+    continuation = response['ContinuationToken']
+
+    response = client.list_buckets(MaxBuckets=1, ContinuationToken=continuation)
+    assert len(response['Buckets']) == 1
+    assert response['Buckets'][0]['Name'] == bucket2
+    assert 'ContinuationToken' not in response
+
 @pytest.fixture
 def override_prefix_a():
     nuke_prefixed_buckets(prefix='a'+get_prefix())