def test_s3_invalid_content_md5(self):
    bucket_name = ('test-bucket-%s' % short_uid())
    self.s3_client.create_bucket(Bucket=bucket_name)
    hashes = {'__invalid__': 'InvalidDigest', '000': 'InvalidDigest', 'not base64 encoded checksum': 'InvalidDigest', 'MTIz': 'BadDigest'}
    for (hash, error) in hashes.items():
        with self.assertRaises(Exception) as ctx:
            self.s3_client.put_object(Bucket=bucket_name, Key='test-key', Body='something', ContentMD5=hash)
        self.assertIn(error, str(ctx.exception))
    self.s3_client.delete_bucket(Bucket=bucket_name)
def test_s3_invalid_content_md5(self):
    bucket_name = ('test-bucket-%s' % short_uid())
    self.s3_client.create_bucket(Bucket=bucket_name)
    hashes = {'__invalid__': 'InvalidDigest', '000': 'InvalidDigest', 'not base64 encoded checksum': 'InvalidDigest', 'MTIz': 'BadDigest'}
    for (hash, error) in hashes.items():
        with self.assertRaises(Exception) as ctx:
            self.s3_client.put_object(Bucket=bucket_name, Key='test-key', Body='something', ContentMD5=hash)
        self.assertIn(error, str(ctx.exception))
    self.s3_client.delete_bucket(Bucket=bucket_name)