From 65b067486ea934f7f4d10fa62f818bc83664c58e Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Thu, 10 Sep 2020 14:39:10 -0400 Subject: [PATCH] test bucket recreation with different acls Signed-off-by: Casey Bodley (cherry picked from commit f6218fa1deaa83e802e246cbb3c0936a2cfb833c) --- s3tests_boto3/functional/test_s3.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/s3tests_boto3/functional/test_s3.py b/s3tests_boto3/functional/test_s3.py index fd62224..adbba24 100644 --- a/s3tests_boto3/functional/test_s3.py +++ b/s3tests_boto3/functional/test_s3.py @@ -4336,6 +4336,34 @@ def test_bucket_create_exists_nonowner(): eq(status, 409) eq(error_code, 'BucketAlreadyExists') +@attr(resource='bucket') +@attr(method='put') +@attr(operation='re-create with existing acl') +@attr(assertion='fails 409') +def test_bucket_recreate_overwrite_acl(): + bucket_name = get_new_bucket_name() + client = get_client() + + client.create_bucket(Bucket=bucket_name, ACL='public-read') + e = assert_raises(ClientError, client.create_bucket, Bucket=bucket_name) + status, error_code = _get_status_and_error_code(e.response) + eq(status, 409) + eq(error_code, 'BucketAlreadyExists') + +@attr(resource='bucket') +@attr(method='put') +@attr(operation='re-create with new acl') +@attr(assertion='fails 409') +def test_bucket_recreate_new_acl(): + bucket_name = get_new_bucket_name() + client = get_client() + + client.create_bucket(Bucket=bucket_name) + e = assert_raises(ClientError, client.create_bucket, Bucket=bucket_name, ACL='public-read') + status, error_code = _get_status_and_error_code(e.response) + eq(status, 409) + eq(error_code, 'BucketAlreadyExists') + def check_access_denied(fn, *args, **kwargs): e = assert_raises(ClientError, fn, *args, **kwargs) status = _get_status(e.response)