Skip to content

Commit 12110d5

Browse files
Add transport response-handler coverage for method casing normalization
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 13a0eff commit 12110d5

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/test_transport_response_handling.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,20 @@ def test_sync_handle_response_with_request_error_includes_method_and_url():
5353
transport.close()
5454

5555

56+
def test_sync_handle_response_with_request_error_normalizes_method_casing():
57+
transport = SyncTransport(api_key="test-key")
58+
try:
59+
with pytest.raises(
60+
HyperbrowserError,
61+
match="Request GET https://example.com/network failed",
62+
):
63+
transport._handle_response(
64+
_RequestErrorResponse("get", "https://example.com/network")
65+
)
66+
finally:
67+
transport.close()
68+
69+
5670
def test_async_handle_response_with_non_json_success_body_returns_status_only():
5771
async def run() -> None:
5872
transport = AsyncTransport(api_key="test-key")
@@ -86,6 +100,23 @@ async def run() -> None:
86100
asyncio.run(run())
87101

88102

103+
def test_async_handle_response_with_request_error_normalizes_method_casing():
104+
async def run() -> None:
105+
transport = AsyncTransport(api_key="test-key")
106+
try:
107+
with pytest.raises(
108+
HyperbrowserError,
109+
match="Request POST https://example.com/network failed",
110+
):
111+
await transport._handle_response(
112+
_RequestErrorResponse("post", "https://example.com/network")
113+
)
114+
finally:
115+
await transport.close()
116+
117+
asyncio.run(run())
118+
119+
89120
def test_sync_handle_response_with_request_error_without_request_context():
90121
transport = SyncTransport(api_key="test-key")
91122
try:

0 commit comments

Comments
 (0)