Skip to content

Commit

Permalink
Fix CRT only tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan343 committed Oct 8, 2024
1 parent c0a79bc commit 2aed29c
Showing 1 changed file with 47 additions and 38 deletions.
85 changes: 47 additions & 38 deletions tests/functional/test_httpchecksum.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import pytest

from botocore.compat import HAS_CRT
from tests import ClientHTTPStubber, patch_load_service_model

TEST_CHECKSUM_SERVICE_MODEL = {
Expand Down Expand Up @@ -147,7 +148,7 @@

def _request_checksum_calculation_cases():
request_payload = "Hello world"
return (
cases = [
(
"CRC32",
request_payload,
Expand All @@ -156,22 +157,6 @@ def _request_checksum_calculation_cases():
"x-amz-checksum-crc32": "i9aeUg==",
},
),
(
"CRC32C",
request_payload,
{
"x-amz-request-algorithm": "CRC32C",
"x-amz-checksum-crc32c": "crUfeA==",
},
),
(
"CRC64NVME",
request_payload,
{
"x-amz-request-algorithm": "CRC64NVME",
"x-amz-checksum-crc64nvme": "OOJZ0D8xKts=",
},
),
(
"SHA1",
request_payload,
Expand All @@ -188,7 +173,27 @@ def _request_checksum_calculation_cases():
"x-amz-checksum-sha256": "ZOyIygCyaOW6GjVnihtTFtIS9PNmskdyMlNKiuyjfzw=",
},
),
)
]
if HAS_CRT:
cases.append(
(
"CRC32C",
request_payload,
{
"x-amz-request-algorithm": "CRC32C",
"x-amz-checksum-crc32c": "crUfeA==",
},
),
(
"CRC64NVME",
request_payload,
{
"x-amz-request-algorithm": "CRC64NVME",
"x-amz-checksum-crc64nvme": "OOJZ0D8xKts=",
},
),
)
return cases


@pytest.mark.parametrize(
Expand Down Expand Up @@ -225,7 +230,7 @@ def test_request_checksum_calculation(

def _streaming_request_checksum_calculation_cases():
request_payload = "Hello world"
return (
cases = [
(
"CRC32",
request_payload,
Expand All @@ -235,24 +240,6 @@ def _streaming_request_checksum_calculation_cases():
},
{"x-amz-checksum-crc32": "i9aeUg=="},
),
(
"CRC32C",
request_payload,
{
"content-encoding": "aws-chunked",
"x-amz-trailer": "x-amz-checksum-crc32c",
},
{"x-amz-checksum-crc32c": "crUfeA=="},
),
(
"CRC64NVME",
request_payload,
{
"content-encoding": "aws-chunked",
"x-amz-trailer": "x-amz-checksum-crc64nvme",
},
{"x-amz-checksum-crc64nvme": "OOJZ0D8xKts="},
),
(
"SHA1",
request_payload,
Expand All @@ -273,7 +260,29 @@ def _streaming_request_checksum_calculation_cases():
"x-amz-checksum-sha256": "ZOyIygCyaOW6GjVnihtTFtIS9PNmskdyMlNKiuyjfzw="
},
),
)
]
if HAS_CRT:
cases.append(
(
"CRC32C",
request_payload,
{
"content-encoding": "aws-chunked",
"x-amz-trailer": "x-amz-checksum-crc32c",
},
{"x-amz-checksum-crc32c": "crUfeA=="},
),
(
"CRC64NVME",
request_payload,
{
"content-encoding": "aws-chunked",
"x-amz-trailer": "x-amz-checksum-crc64nvme",
},
{"x-amz-checksum-crc64nvme": "OOJZ0D8xKts="},
),
)
return cases


@pytest.mark.parametrize(
Expand Down

0 comments on commit 2aed29c

Please sign in to comment.