MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / test_adc_path

Function test_adc_path

tests/lib/test_google_cloud.py:354–365  ·  view source on GitHub ↗
(respx_mock: MockRouter, monkeypatch: pytest.MonkeyPatch)

Source from the content-addressed store, hash-verified

352
353@pytest.mark.respx()
354def 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()

Callers

nothing calls this directly

Calls 4

_FakeCredentialsClass · 0.85
postMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected