Add a test that uses Key.set_contents_from_file, to trigger 100 Continue.

This commit is contained in:
Tommi Virtanen 2011-06-07 10:47:27 -07:00
parent e8a5077913
commit 818523f48c

View file

@ -1,3 +1,4 @@
from cStringIO import StringIO
import ConfigParser
import boto.exception
import boto.s3.connection
@ -253,6 +254,18 @@ def test_object_set_get_metadata():
eq(got, 'mymeta')
def test_object_write_file():
# boto Key.set_contents_from_file / .send_file uses Expect:
# 100-Continue, so this test exercises that (though a bit too
# subtly)
bucket = get_new_bucket()
key = bucket.new_key('foo')
data = StringIO('bar')
key.set_contents_from_file(fp=data)
got = key.get_contents_as_string()
eq(got, 'bar')
def check_bad_bucket_name(name):
e = assert_raises(boto.exception.S3ResponseError, s3.main.create_bucket, name)
eq(e.status, 400)