]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
Copy tests for non-existent buckets and keys 49/head
authorAndrew Gaul <andrew@gaul.org>
Sat, 18 Apr 2015 10:54:37 +0000 (03:54 -0700)
committerAndrew Gaul <andrew@gaul.org>
Sat, 18 Apr 2015 11:12:43 +0000 (04:12 -0700)
Signed-off-by: Andrew Gaul <andrew@gaul.org>
s3tests/functional/test_s3.py

index a4781fb2e0f7c2c1d213c6b454f2d6417646bccf..568bcd98178b3642ac78661a7522f32be1dd6fdd 100644 (file)
@@ -4473,6 +4473,26 @@ def test_object_copy_replacing_metadata():
     eq(key2.metadata, metadata)
     eq(key2.content_type, content_type)
 
+@attr(resource='object')
+@attr(method='put')
+@attr(operation='copy from non-existent bucket')
+def test_object_copy_bucket_not_found():
+    bucket = get_new_bucket()
+    e = assert_raises(boto.exception.S3ResponseError, bucket.copy_key, 'foo123bar', bucket.name + "-fake", 'bar321foo')
+    eq(e.status, 404)
+    eq(e.reason, 'Not Found')
+    eq(e.error_code, 'NoSuchBucket')
+
+@attr(resource='object')
+@attr(method='put')
+@attr(operation='copy from non-existent object')
+def test_object_copy_key_not_found():
+    bucket = get_new_bucket()
+    e = assert_raises(boto.exception.S3ResponseError, bucket.copy_key, 'foo123bar', bucket.name, 'bar321foo')
+    eq(e.status, 404)
+    eq(e.reason, 'Not Found')
+    eq(e.error_code, 'NoSuchKey')
+
 def transfer_part(bucket, mp_id, mp_keyname, i, part):
     """Transfer a part of a multipart upload. Designed to be run in parallel.
     """