]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
Add multipart tests with invalid parts 53/head
authorAndrew Gaul <andrew@gaul.org>
Sat, 2 May 2015 17:51:30 +0000 (10:51 -0700)
committerAndrew Gaul <andrew@gaul.org>
Sat, 2 May 2015 18:09:31 +0000 (11:09 -0700)
Signed-off-by: Andrew Gaul <andrew@gaul.org>
s3tests/functional/test_s3.py

index 761e4783ff869fabc87fa39f8dc32a715cd61182..5468185730d2f9fe4c3e54959bb4c742a729cad4 100644 (file)
@@ -4716,6 +4716,36 @@ def test_list_multipart_upload():
     upload2.cancel_upload()
     upload3.cancel_upload()
 
+@attr(resource='object')
+@attr(method='put')
+@attr(operation='multi-part upload with missing part')
+def test_multipart_upload_missing_part():
+    bucket = get_new_bucket()
+    key_name = "mymultipart"
+    mp = bucket.initiate_multipart_upload(key_name)
+    mp.upload_part_from_file(StringIO('\x00'), 1)
+    xml = mp.to_xml()
+    xml = xml.replace('<PartNumber>1</PartNumber>', '<PartNumber>9999</PartNumber>')
+    e = assert_raises(boto.exception.S3ResponseError, bucket.complete_multipart_upload, key_name, mp.id, xml)
+    eq(e.status, 400)
+    eq(e.reason, 'Bad Request')
+    eq(e.error_code, 'InvalidPart')
+
+@attr(resource='object')
+@attr(method='put')
+@attr(operation='multi-part upload with incorrect ETag')
+def test_multipart_upload_incorrect_etag():
+    bucket = get_new_bucket()
+    key_name = "mymultipart"
+    mp = bucket.initiate_multipart_upload(key_name)
+    mp.upload_part_from_file(StringIO('\x00'), 1)
+    xml = mp.to_xml()
+    xml = xml.replace('<ETag>"93b885adfe0da089cdf634904fd59f71"</ETag>', '<ETag>"ffffffffffffffffffffffffffffffff"</ETag>')
+    e = assert_raises(boto.exception.S3ResponseError, bucket.complete_multipart_upload, key_name, mp.id, xml)
+    eq(e.status, 400)
+    eq(e.reason, 'Bad Request')
+    eq(e.error_code, 'InvalidPart')
+
 def _simple_http_req_100_cont(host, port, is_secure, method, resource):
     """
     Send the specified request w/expect 100-continue