]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
Test S3 api for handling of Content-MD5 that does not match.
authorTommi Virtanen <tommi.virtanen@dreamhost.com>
Wed, 10 Aug 2011 21:55:34 +0000 (14:55 -0700)
committerTommi Virtanen <tommi.virtanen@dreamhost.com>
Wed, 10 Aug 2011 21:55:34 +0000 (14:55 -0700)
The existing test_object_create_bad_md5_invalid is not valid
base64, and hence triggers a different code path. This time,
submit valid base64, but have the result not match the expected
md5sum.

s3tests/functional/test_headers.py

index 164c2ad6dad4413d80c638543e48242660255f4d..08e3902d90ed2e673e3b7ff38fa615b96a939c5b 100644 (file)
@@ -159,6 +159,17 @@ def test_object_create_bad_md5_invalid():
     eq(e.error_code, 'InvalidDigest')
 
 
+@nose.with_setup(teardown=_clear_custom_headers)
+@attr('fails_on_dho')
+def test_object_create_bad_md5_wrong():
+    key = _setup_bad_object({'Content-MD5':'YWJyYWNhZGFicmE='})
+
+    e = assert_raises(boto.exception.S3ResponseError, key.set_contents_from_string, 'bar')
+    eq(e.status, 400)
+    eq(e.reason, 'Bad Request')
+    eq(e.error_code, 'InvalidDigest')
+
+
 @nose.with_setup(teardown=_clear_custom_headers)
 @attr('fails_on_dho')
 def test_object_create_bad_md5_empty():