Skip to content

Commit

Permalink
fix testing issue; Assert actual checksum values in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan343 committed Nov 22, 2024
1 parent 503ead6 commit 509440a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions botocore/httpchecksum.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,11 @@ def resolve_request_checksum_algorithm(
algorithm_member_header = _get_request_algorithm_member_header(
operation_model, request, algorithm_member
)
checksum_context["request_algorithm_header"] = {
"name": algorithm_member_header,
"value": DEFAULT_CHECKSUM_ALGORITHM,
}
if algorithm_member_header is not None:
checksum_context["request_algorithm_header"] = {
"name": algorithm_member_header,
"value": DEFAULT_CHECKSUM_ALGORITHM,
}
else:
return

Expand Down
6 changes: 3 additions & 3 deletions tests/functional/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,7 @@ def test_trailing_checksum_set(self):
b"STREAMING-UNSIGNED-PAYLOAD-TRAILER",
)
body = self.http_stubber.requests[0].body.read()
self.assertIn(b"x-amz-checksum-crc32", body)
self.assertIn(b"x-amz-checksum-crc32:eCQEmA==", body)

def test_trailing_checksum_set_empty_body(self):
with self.http_stubber:
Expand All @@ -1551,7 +1551,7 @@ def test_trailing_checksum_set_empty_body(self):
b"STREAMING-UNSIGNED-PAYLOAD-TRAILER",
)
body = self.http_stubber.requests[0].body.read()
self.assertIn(b"x-amz-checksum-crc32", body)
self.assertIn(b"x-amz-checksum-crc32:AAAAAA==", body)

def test_trailing_checksum_set_empty_file(self):
with self.http_stubber:
Expand All @@ -1570,7 +1570,7 @@ def test_trailing_checksum_set_empty_file(self):
sent_headers["x-amz-content-sha256"],
b"STREAMING-UNSIGNED-PAYLOAD-TRAILER",
)
self.assertIn(b"x-amz-checksum-crc32", body)
self.assertIn(b"x-amz-checksum-crc32:AAAAAA==", body)

def test_content_sha256_not_set_if_config_value_is_true(self):
# By default, put_object() provides a trailing checksum and includes the
Expand Down

0 comments on commit 509440a

Please sign in to comment.