mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
fix(tests): mock user_api_key_auth in test_vertex_passthrough_with_no_default_credentials
vertex_proxy_route calls user_api_key_auth internally. When a prior test in the same xdist worker sets master_key, the auth check fails for the test request and create_pass_through_route is never called, causing assert_called_once_with to fail. Fix: patch user_api_key_auth as an AsyncMock in the with mock.patch() block.
This commit is contained in:
parent
804ecfd2c7
commit
35060bfbeb
1 changed files with 5 additions and 1 deletions
|
|
@ -541,9 +541,13 @@ class TestVertexAIPassThroughHandler:
|
|||
"litellm.proxy.pass_through_endpoints.llm_passthrough_endpoints.vertex_llm_base._get_token_and_url"
|
||||
) as mock_get_token, mock.patch(
|
||||
"litellm.proxy.pass_through_endpoints.llm_passthrough_endpoints.create_pass_through_route"
|
||||
) as mock_create_route:
|
||||
) as mock_create_route, mock.patch(
|
||||
"litellm.proxy.pass_through_endpoints.llm_passthrough_endpoints.user_api_key_auth",
|
||||
new_callable=AsyncMock,
|
||||
) as mock_auth:
|
||||
mock_ensure_token.return_value = ("test-auth-header", test_project)
|
||||
mock_get_token.return_value = (test_token, "")
|
||||
mock_auth.return_value = MagicMock()
|
||||
|
||||
# Call the route
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue