Fix: ListObjectsV2 behaving differently than AWS API (#3545)
* fix : localstack issue https://github.com/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22+language%3Ago * add assertion for error message as well
This commit is contained in:
parent
e6be3265ca
commit
dffc0e449c
3 changed files with 43 additions and 1 deletions
|
|
@ -1809,6 +1809,32 @@ def test_boto3_list_objects_v2_common_prefix_pagination():
|
|||
assert prefixes == [k[: k.rindex("/") + 1] for k in keys]
|
||||
|
||||
|
||||
@mock_s3
|
||||
def test_boto3_list_objects_v2_common_invalid_continuation_token():
|
||||
s3 = boto3.client("s3", region_name=DEFAULT_REGION_NAME)
|
||||
s3.create_bucket(Bucket="mybucket")
|
||||
|
||||
max_keys = 1
|
||||
keys = ["test/{i}/{i}".format(i=i) for i in range(3)]
|
||||
for key in keys:
|
||||
s3.put_object(Bucket="mybucket", Key=key, Body=b"v")
|
||||
|
||||
args = {
|
||||
"Bucket": "mybucket",
|
||||
"Delimiter": "/",
|
||||
"Prefix": "test/",
|
||||
"MaxKeys": max_keys,
|
||||
"ContinuationToken": "",
|
||||
}
|
||||
|
||||
with pytest.raises(botocore.exceptions.ClientError) as exc:
|
||||
s3.list_objects_v2(**args)
|
||||
exc.value.response["Error"]["Code"].should.equal("InvalidArgument")
|
||||
exc.value.response["Error"]["Message"].should.equal(
|
||||
"The continuation token provided is incorrect"
|
||||
)
|
||||
|
||||
|
||||
@mock_s3
|
||||
def test_boto3_list_objects_v2_truncated_response():
|
||||
s3 = boto3.client("s3", region_name=DEFAULT_REGION_NAME)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue