Test S3 api for handling of Content-MD5 that does not match.

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.
This commit is contained in:
Tommi Virtanen 2011-08-10 14:55:34 -07:00
parent 0e9935a01e
commit 199b8b46c5

View file

@ -159,6 +159,17 @@ def test_object_create_bad_md5_invalid():
eq(e.error_code, 'InvalidDigest') 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) @nose.with_setup(teardown=_clear_custom_headers)
@attr('fails_on_dho') @attr('fails_on_dho')
def test_object_create_bad_md5_empty(): def test_object_create_bad_md5_empty():