Skip to content

Commit 920c362

Browse files
committed
Add test
1 parent 64cd6b4 commit 920c362

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

packages/smithy-http/tests/unit/aio/test_crt.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
from copy import deepcopy
4+
from io import BytesIO
45

56
import pytest
67

8+
from smithy_core import URI
9+
from smithy_http import Fields
10+
from smithy_http.aio import HTTPRequest
711
from smithy_http.aio.crt import AWSCRTHTTPClient, BufferableByteStream
812

913

@@ -12,6 +16,22 @@ def test_deepcopy_client() -> None:
1216
deepcopy(client)
1317

1418

19+
async def test_client_marshal_request() -> None:
20+
client = AWSCRTHTTPClient()
21+
request = HTTPRequest(
22+
method="GET",
23+
destination=URI(
24+
host="example.com", path="/path", query="key1=value1&key2=value2"
25+
),
26+
body=BytesIO(),
27+
fields=Fields(),
28+
)
29+
crt_request = await client._marshal_request(request) # type: ignore
30+
assert crt_request.headers.get("host") == "example.com" # type: ignore
31+
assert crt_request.method == "GET" # type: ignore
32+
assert crt_request.path == "/path?key1=value1&key2=value2" # type: ignore
33+
34+
1535
def test_stream_write() -> None:
1636
stream = BufferableByteStream()
1737
stream.write(b"foo")

0 commit comments

Comments
 (0)