Fix duplicate bucket creation with LocationConstraint. Closes #970.

This commit is contained in:
Steve Pulec 2017-06-03 19:29:59 -04:00
commit 113bfcb4ea
2 changed files with 22 additions and 0 deletions

View file

@ -1207,6 +1207,22 @@ def test_boto3_bucket_create():
"utf-8").should.equal("some text")
@mock_s3
def test_bucket_create_duplicate():
s3 = boto3.resource('s3', region_name='us-west-2')
s3.create_bucket(Bucket="blah", CreateBucketConfiguration={
'LocationConstraint': 'us-west-2',
})
with assert_raises(ClientError) as exc:
s3.create_bucket(
Bucket="blah",
CreateBucketConfiguration={
'LocationConstraint': 'us-west-2',
}
)
exc.exception.response['Error']['Code'].should.equal('BucketAlreadyExists')
@mock_s3
def test_boto3_bucket_create_eu_central():
s3 = boto3.resource('s3', region_name='eu-central-1')