Cleanup S3 model methods to better deal with missing buckets.

This commit is contained in:
Steve Pulec 2014-07-08 21:20:29 -04:00
commit 5e35348c0d
4 changed files with 104 additions and 76 deletions

View file

@ -149,6 +149,16 @@ def test_list_multiparts():
uploads.should.be.empty
@mock_s3
def test_key_save_to_missing_bucket():
conn = boto.connect_s3('the_key', 'the_secret')
bucket = conn.get_bucket('mybucket', validate=False)
key = Key(bucket)
key.key = "the-key"
key.set_contents_from_string.when.called_with("foobar").should.throw(S3ResponseError)
@mock_s3
def test_missing_key():
conn = boto.connect_s3('the_key', 'the_secret')