Skip to content

Commit

Permalink
Add S3 tests for PutObject empty body
Browse files Browse the repository at this point in the history
  • Loading branch information
nateprewitt committed Nov 16, 2020
1 parent 7d36d94 commit b263f6e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/functional/test_s3.py
Expand Up @@ -919,6 +919,18 @@ def test_content_md5_set(self):
self.client.put_object(Bucket='foo', Key='bar', Body='baz')
self.assertIn('content-md5', self.get_sent_headers())

def test_content_md5_set_empty_body(self):
with self.http_stubber:
self.client.put_object(Bucket='foo', Key='bar', Body='')
self.assertIn('content-md5', self.get_sent_headers())

def test_content_md5_set_empty_file(self):
with self.http_stubber:
with temporary_file('rb') as f:
assert f.read() == b''
self.client.put_object(Bucket='foo', Key='bar', Body=f)
self.assertIn('content-md5', self.get_sent_headers())

def test_content_sha256_set_if_config_value_is_true(self):
config = Config(signature_version='s3v4', s3={
'payload_signing_enabled': True
Expand Down

0 comments on commit b263f6e

Please sign in to comment.