Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down