diff --git a/tests/test_client.py b/tests/test_client.py index 95b22d49..bc48551d 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -32,10 +32,14 @@ def _get_params(client: BaseClient) -> dict[str, str]: class TestFinch: client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=True) - def test_raw_response(self) -> None: - response = self.client.get("/providers", cast_to=httpx.Response) + @pytest.mark.respx(base_url=base_url) + def test_raw_response(self, respx_mock: MockRouter) -> None: + respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + response = self.client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) + assert response.json() == {"foo": "bar"} def test_copy(self) -> None: copied = self.client.copy() @@ -420,10 +424,15 @@ class Model(BaseModel): class TestAsyncFinch: client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=True) - async def test_raw_response(self) -> None: - response = await self.client.get("/providers", cast_to=httpx.Response) + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + async def test_raw_response(self, respx_mock: MockRouter) -> None: + respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + response = await self.client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) + assert response.json() == {"foo": "bar"} def test_copy(self) -> None: copied = self.client.copy()