(respx_mock: MockRouter, monkeypatch: pytest.MonkeyPatch)
| 356 | |
| 357 | @pytest.mark.respx() |
| 358 | def test_adc_path(respx_mock: MockRouter, monkeypatch: pytest.MonkeyPatch) -> None: |
| 359 | respx_mock.post(re.compile(r"https://example\.test/.*")).mock( |
| 360 | return_value=httpx2.Response(200, json={"foo": "bar"}) |
| 361 | ) |
| 362 | |
| 363 | monkeypatch.setattr( |
| 364 | "anthropic.lib.google_cloud._client._load_adc_credentials", |
| 365 | lambda: (_FakeCredentials(token="adc-token"), None), |
| 366 | ) |
| 367 | client = AnthropicGoogleCloud(base_url="https://example.test/", workspace_id="wrkspc_x") |
| 368 | client.messages.create(max_tokens=16, messages=[{"role": "user", "content": "hi"}], model="claude-haiku-4-5") |
| 369 | |
| 370 | calls = cast("list[Any]", respx_mock.calls) |
| 371 | assert calls[0].request.headers["Authorization"] == "Bearer adc-token" |
| 372 | |
| 373 | |
| 374 | @pytest.mark.respx() |
nothing calls this directly
no test coverage detected