diff --git a/tests/test_s3/test_s3.py b/tests/test_s3/test_s3.py index 75a1348a7..f5d7cba15 100644 --- a/tests/test_s3/test_s3.py +++ b/tests/test_s3/test_s3.py @@ -9,6 +9,7 @@ from io import BytesIO import json import boto import boto3 +from botocore.client import ClientError from boto.exception import S3CreateError, S3ResponseError from boto.s3.connection import S3Connection from boto.s3.key import Key @@ -890,3 +891,16 @@ def test_boto3_bucket_create(): s3.Object('blah', 'hello.txt').put(Body="some text") s3.Object('blah', 'hello.txt').get()['Body'].read().decode("utf-8").should.equal("some text") + + +@mock_s3 +def test_boto3_head_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 err: + s3.Object('blah', 'hello2.txt').meta.client.head_object(Bucket='blah', Key='hello_bad.txt')