From a6c6edbca4378d5dcf871c6879b0e6853700a181 Mon Sep 17 00:00:00 2001 From: Adam DePue Date: Thu, 13 Aug 2015 21:16:55 +0000 Subject: [PATCH] Add more boto3 s3 tests --- tests/test_s3/test_s3.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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')