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

Function test_adc_path

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

Source from the content-addressed store, hash-verified

543
544@pytest.mark.respx()
545def 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()

Callers

nothing calls this directly

Calls 4

_FakeCredentialsClass · 0.85
postMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected