MCPcopy
hub / github.com/openai/openai-python / test_copy_auth

Method test_copy_auth

tests/test_client.py:2646–2655  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2644 assert calls[1].request.headers.get("Authorization") == "Bearer second"
2645
2646 async def test_copy_auth(self) -> None:
2647 async def token_provider_1() -> str:
2648 return "test_bearer_token_1"
2649
2650 async def token_provider_2() -> str:
2651 return "test_bearer_token_2"
2652
2653 client = AsyncOpenAI(base_url=base_url, api_key=token_provider_1).copy(api_key=token_provider_2)
2654 await client._refresh_api_key()
2655 assert client.auth_headers == {"Authorization": "Bearer test_bearer_token_2"}
2656
2657
2658class TestWorkloadIdentity401Retry:

Callers

nothing calls this directly

Calls 3

AsyncOpenAIClass · 0.90
copyMethod · 0.45
_refresh_api_keyMethod · 0.45

Tested by

no test coverage detected