(respx_mock: MockRouter, monkeypatch: pytest.MonkeyPatch)
| 543 | |
| 544 | @pytest.mark.respx() |
| 545 | def test_adc_path(respx_mock: MockRouter, monkeypatch: pytest.MonkeyPatch) -> None: |
| 546 | respx_mock.post(re.compile(r"https://example\.test/.*")).mock( |
| 547 | return_value=httpx2.Response(200, json={"foo": "bar"}) |
| 548 | ) |
| 549 | |
| 550 | monkeypatch.setattr( |
| 551 | "anthropic.lib.google_cloud._client._load_adc_credentials", |
| 552 | lambda: (_FakeCredentials(token="adc-token"), None), |
| 553 | ) |
| 554 | client = AnthropicGoogleCloud(base_url="https://example.test/", workspace_id="wrkspc_x") |
| 555 | client.messages.create(max_tokens=16, messages=[{"role": "user", "content": "hi"}], model="claude-haiku-4-5") |
| 556 | |
| 557 | calls = cast("list[Any]", respx_mock.calls) |
| 558 | assert calls[0].request.headers["Authorization"] == "Bearer adc-token" |
| 559 | |
| 560 | |
| 561 | @pytest.mark.respx() |
nothing calls this directly
no test coverage detected