Merge pull request #661 from braintreeps/fix-s3-errors

Update format of S3 client errors
This commit is contained in:
Steve Pulec 2016-07-09 21:12:57 -04:00 committed by GitHub
commit 9d281844cd
3 changed files with 31 additions and 3 deletions

View file

@ -1013,6 +1013,21 @@ def test_boto3_head_object():
s3.Object('blah', 'hello2.txt').meta.client.head_object(Bucket='blah', Key='hello_bad.txt')
@mock_s3
def test_boto3_get_object():
s3 = boto3.resource('s3', region_name='us-east-1')
s3.create_bucket(Bucket="blah")
s3.Object('blah', 'hello.txt').put(Body="some text")
s3.Object('blah', 'hello.txt').meta.client.head_object(Bucket='blah', Key='hello.txt')
with assert_raises(ClientError) as e:
s3.Object('blah', 'hello2.txt').get()
e.exception.response['Error']['Code'].should.equal('NoSuchKey')
@mock_s3
def test_boto3_head_object_with_versioning():
s3 = boto3.resource('s3', region_name='us-east-1')