Allow writing empty body to s3 key if content-length is zero. Better fix for #6.

This commit is contained in:
Steve Pulec 2013-03-26 10:11:16 -04:00
commit e64c73efed
2 changed files with 25 additions and 13 deletions

View file

@ -62,6 +62,20 @@ def test_empty_key():
bucket.get_key("the-key").get_contents_as_string().should.equal('')
@mock_s3
def test_empty_key_set_on_existing_key():
conn = boto.connect_s3('the_key', 'the_secret')
bucket = conn.create_bucket("foobar")
key = Key(bucket)
key.key = "the-key"
key.set_contents_from_string("foobar")
bucket.get_key("the-key").get_contents_as_string().should.equal('foobar')
key.set_contents_from_string("")
bucket.get_key("the-key").get_contents_as_string().should.equal('')
@mock_s3
def test_copy_key():
conn = boto.connect_s3('the_key', 'the_secret')