From 113269860597a4bc282e36e9e68879886369790a Mon Sep 17 00:00:00 2001 From: Stephon Striplin Date: Mon, 11 Jul 2011 12:15:33 -0700 Subject: [PATCH] add test_bucket_delete_nonempty --- test_s3.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test_s3.py b/test_s3.py index 23b6598..179f17a 100644 --- a/test_s3.py +++ b/test_s3.py @@ -233,6 +233,19 @@ def test_bucket_delete_notexist(): eq(e.reason, 'Not Found') eq(e.error_code, 'NoSuchBucket') +def test_bucket_delete_nonempty(): + bucket = get_new_bucket() + + # fill up bucket + obj = bunch.Bunch() + obj.a = bucket.new_key('foo') + obj.a.set_contents_from_string('foocontent') + + # try to delete + e = assert_raises(boto.exception.S3ResponseError, bucket.delete) + eq(e.status, 409) + eq(e.reason, 'Conflict') + eq(e.error_code, 'BucketNotEmpty') def test_object_write_to_nonexist_bucket(): name = '{prefix}foo'.format(prefix=prefix)