forked from TrueCloudLab/s3-tests
add tests for setting wacky metadata
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
This commit is contained in:
parent
d81e2d40e6
commit
015bc308af
1 changed files with 23 additions and 0 deletions
23
test_s3.py
23
test_s3.py
|
@ -296,6 +296,29 @@ def test_object_set_get_metadata():
|
|||
eq(got, 'mymeta')
|
||||
|
||||
|
||||
# UTF-8 encoded data should pass straight through
|
||||
def test_object_set_get_unicode_metadata():
|
||||
bucket = get_new_bucket()
|
||||
key = boto.s3.key.Key(bucket)
|
||||
key.key = (u'foo')
|
||||
key.set_metadata('meta1', u"Hello World\xe9")
|
||||
key.set_contents_from_string('bar')
|
||||
key2 = bucket.get_key('foo')
|
||||
got = key2.get_metadata('meta1')
|
||||
eq(got, u"Hello World\xe9")
|
||||
|
||||
|
||||
def test_object_set_get_non_utf8_metadata():
|
||||
bucket = get_new_bucket()
|
||||
key = boto.s3.key.Key(bucket)
|
||||
key.key = ('foo')
|
||||
key.set_metadata('meta1', '\x04mymeta')
|
||||
key.set_contents_from_string('bar')
|
||||
key2 = bucket.get_key('foo')
|
||||
got = key2.get_metadata('meta1')
|
||||
eq(got, '=?UTF-8?Q?=04mymeta?=')
|
||||
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue