@@ -32,10 +32,14 @@ def _get_params(client: BaseClient) -> dict[str, str]:
32
32
class TestFinch :
33
33
client = Finch (base_url = base_url , access_token = access_token , _strict_response_validation = True )
34
34
35
- def test_raw_response (self ) -> None :
36
- response = self .client .get ("/providers" , cast_to = httpx .Response )
35
+ @pytest .mark .respx (base_url = base_url )
36
+ def test_raw_response (self , respx_mock : MockRouter ) -> None :
37
+ respx_mock .post ("/foo" ).mock (return_value = httpx .Response (200 , json = {"foo" : "bar" }))
38
+
39
+ response = self .client .post ("/foo" , cast_to = httpx .Response )
37
40
assert response .status_code == 200
38
41
assert isinstance (response , httpx .Response )
42
+ assert response .json () == {"foo" : "bar" }
39
43
40
44
def test_copy (self ) -> None :
41
45
copied = self .client .copy ()
@@ -420,10 +424,15 @@ class Model(BaseModel):
420
424
class TestAsyncFinch :
421
425
client = AsyncFinch (base_url = base_url , access_token = access_token , _strict_response_validation = True )
422
426
423
- async def test_raw_response (self ) -> None :
424
- response = await self .client .get ("/providers" , cast_to = httpx .Response )
427
+ @pytest .mark .respx (base_url = base_url )
428
+ @pytest .mark .asyncio
429
+ async def test_raw_response (self , respx_mock : MockRouter ) -> None :
430
+ respx_mock .post ("/foo" ).mock (return_value = httpx .Response (200 , json = {"foo" : "bar" }))
431
+
432
+ response = await self .client .post ("/foo" , cast_to = httpx .Response )
425
433
assert response .status_code == 200
426
434
assert isinstance (response , httpx .Response )
435
+ assert response .json () == {"foo" : "bar" }
427
436
428
437
def test_copy (self ) -> None :
429
438
copied = self .client .copy ()
0 commit comments