| 126 | class TestOpenAI: |
| 127 | @pytest.mark.respx(base_url=base_url) |
| 128 | def test_raw_response(self, respx_mock: MockRouter, client: OpenAI) -> None: |
| 129 | respx_mock.post(class="st">"/foo").mock(return_value=httpx.Response(200, json={class="st">"foo": class="st">"bar"})) |
| 130 | |
| 131 | response = client.post(class="st">"/foo", cast_to=httpx.Response) |
| 132 | assert response.status_code == 200 |
| 133 | assert isinstance(response, httpx.Response) |
| 134 | assert response.json() == {class="st">"foo": class="st">"bar"} |
| 135 | |
| 136 | @pytest.mark.respx(base_url=base_url) |
| 137 | def test_raw_response_for_binary(self, respx_mock: MockRouter, client: OpenAI) -> None: |