diff --git a/tests/test_client.py b/tests/test_client.py index 4a0d1bb63..6bff279ea 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -31,10 +31,14 @@ def _get_params(client: BaseClient) -> dict[str, str]: class TestIncrease: client = Increase(base_url=base_url, api_key=api_key, _strict_response_validation=True) - def test_raw_response(self) -> None: - response = self.client.get("/accounts", options={"params": {}}, 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() @@ -424,10 +428,15 @@ class Model(BaseModel): class TestAsyncIncrease: client = AsyncIncrease(base_url=base_url, api_key=api_key, _strict_response_validation=True) - async def test_raw_response(self) -> None: - response = await self.client.get("/accounts", options={"params": {}}, 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()