Merge pull request #401 from adepue/boto3

Add more boto3 s3 tests
This commit is contained in:
Steve Pulec 2015-08-13 17:22:39 -04:00
commit 36930c278f

View File

@ -9,6 +9,7 @@ from io import BytesIO
import json import json
import boto import boto
import boto3 import boto3
from botocore.client import ClientError
from boto.exception import S3CreateError, S3ResponseError from boto.exception import S3CreateError, S3ResponseError
from boto.s3.connection import S3Connection from boto.s3.connection import S3Connection
from boto.s3.key import Key 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').put(Body="some text")
s3.Object('blah', 'hello.txt').get()['Body'].read().decode("utf-8").should.equal("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')