File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff 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+
5670def 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+
89120def test_sync_handle_response_with_request_error_without_request_context ():
90121 transport = SyncTransport (api_key = "test-key" )
91122 try :
You can’t perform that action at this time.
0 commit comments