test: adapt picked tests to stable/1.84.x fixture surface

Three test-only adaptations required by the picks, none touching
production code: restore the AsyncMock import that the upstream
test_proxy_cli.py carries; drop three patch() entries targeting
seed_request_identity, a helper that does not exist on this line; and
re-graft the #30160 test block verbatim from the upstream hunk so the
@patch decorators are included
This commit is contained in:
Yuneng Jiang 2026-06-12 17:01:23 -07:00
parent 973c7eb8d6
commit c55c292135
No known key found for this signature in database
3 changed files with 3 additions and 10 deletions

View file

@ -144,9 +144,6 @@ async def test_handle_authentication_error_db_infra_error_returns_503(db_error):
new_callable=AsyncMock,
return_value=None,
),
patch(
"litellm.proxy.auth.auth_exception_handler.seed_request_identity",
),
patch(
"litellm.proxy.proxy_server.general_settings",
{"allow_requests_on_db_unavailable": False},
@ -201,9 +198,6 @@ async def test_handle_authentication_error_prisma_engine_teardown_returns_503():
new_callable=AsyncMock,
return_value=None,
),
patch(
"litellm.proxy.auth.auth_exception_handler.seed_request_identity",
),
patch(
"litellm.proxy.proxy_server.general_settings",
{"allow_requests_on_db_unavailable": False},
@ -251,9 +245,6 @@ async def test_handle_authentication_error_genuine_auth_failure_stays_401(auth_e
new_callable=AsyncMock,
return_value=None,
),
patch(
"litellm.proxy.auth.auth_exception_handler.seed_request_identity",
),
patch(
"litellm.proxy.proxy_server.general_settings",
{"allow_requests_on_db_unavailable": False},

View file

@ -321,6 +321,7 @@ class TestAzureAnthropicCostCalculation:
assert call_kwargs["model"] == "azure_ai/claude-sonnet-4-5_gb_20250929"
assert call_kwargs["custom_llm_provider"] == "azure_ai"
@patch("litellm.completion_cost")
def test_cost_calculation_resolves_unknown_model_from_litellm_params(
self, mock_completion_cost
):
@ -583,6 +584,7 @@ class TestAzureAnthropicCostCalculation:
== "claude-3-5-haiku-20241022"
)
class TestAnthropicBatchPassthroughCostTracking:
"""Test cases for Anthropic batch passthrough cost tracking functionality"""

View file

@ -1,6 +1,6 @@
import os
import sys
from unittest.mock import MagicMock, patch
from unittest.mock import AsyncMock, MagicMock, patch
import fastapi
import pytest