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