The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test(files): capture routed retrieval calls immutably
Marty Sullivan460f0d29a95c
diff --git a/tests/test_litellm/proxy/openai_files_endpoint/test_files_endpoint.py b/tests/test_litellm/proxy/openai_files_endpoint/test_files_endpoint.pyindex 0c26e5f7695..e363a266688 100644--- a/tests/test_litellm/proxy/openai_files_endpoint/test_files_endpoint.py+++ b/tests/test_litellm/proxy/openai_files_endpoint/test_files_endpoint.py@@ -3194,10 +3194,12 @@ def test_get_file_content_model_routed_attaches_trusted_model_credentials(monkeymonkeypatch.setattr("litellm.proxy.proxy_server.master_key", None)monkeypatch.setattr("litellm.proxy.proxy_server.llm_router", router)- captured_kwargs: dict = {}+ # One frozen snapshot per call rather than one dict merged across calls, so a second+ # invocation is visible instead of silently overwriting the first.+ calls: list[MappingProxyType] = []async def _mock_router_afile_content(**kwargs):- captured_kwargs.update(kwargs)+ calls.append(MappingProxyType(dict(kwargs)))return HttpxBinaryResponseContent(response=httpx.Response(status_code=200,@@ -3231,7 +3233,8 @@ def test_get_file_content_model_routed_attaches_trusted_model_credentials(monkeyapp.dependency_overrides.pop(ps.user_api_key_auth, None)assert response.status_code == 200, response.text- snapshot = captured_kwargs.get("_litellm_internal_model_credentials")+ assert len(calls) == 1, f"expected exactly one routed retrieval, got {len(calls)}"+ snapshot = calls[0].get("_litellm_internal_model_credentials")assert snapshot is not None, "model-routed branch must attach the trusted credential snapshot"assert isinstance(snapshot, MappingProxyType