Return correct error when creating a bucket with empty CreateBucketConfiguration (#3079)
* Several updates to the contributor documentation with extra information. * Fix failing test by providing a region. * Create test for issue 2210. * Check if CreateBucketConfiguration is supplied and empty; raise MalformedXML error if so.
This commit is contained in:
parent
6305f707d2
commit
8ce12027dd
3 changed files with 43 additions and 9 deletions
|
|
@ -1042,7 +1042,7 @@ def test_s3_object_in_public_bucket_using_multiple_presigned_urls():
|
|||
|
||||
@mock_s3
|
||||
def test_streaming_upload_from_file_to_presigned_url():
|
||||
s3 = boto3.resource("s3")
|
||||
s3 = boto3.resource("s3", region_name="us-east-1")
|
||||
bucket = s3.Bucket("test-bucket")
|
||||
bucket.create()
|
||||
bucket.put_object(Body=b"ABCD", Key="file.txt")
|
||||
|
|
@ -1976,6 +1976,15 @@ def test_boto3_bucket_create_eu_central():
|
|||
)
|
||||
|
||||
|
||||
@mock_s3
|
||||
def test_bucket_create_empty_bucket_configuration_should_return_malformed_xml_error():
|
||||
s3 = boto3.resource("s3", region_name="us-east-1")
|
||||
with assert_raises(ClientError) as e:
|
||||
s3.create_bucket(Bucket="whatever", CreateBucketConfiguration={})
|
||||
e.exception.response["Error"]["Code"].should.equal("MalformedXML")
|
||||
e.exception.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
|
||||
|
||||
|
||||
@mock_s3
|
||||
def test_boto3_head_object():
|
||||
s3 = boto3.resource("s3", region_name=DEFAULT_REGION_NAME)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue