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
Adding test
yuneng-jiang943445dd0f77
diff --git a/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.pyindex 97d5381ee1e..c9a10e3c4d0 100644--- a/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py+++ b/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py@@ -3,6 +3,7 @@ import osimport sysimport pytest+import yamlfrom fastapi.testclient import TestClientsys.path.insert(@@ -3688,10 +3689,12 @@ async def test_generate_key_with_router_settings(monkeypatch):)# Test router_settings with sample data+ # Using valid UpdateRouterConfig fields (retry_policy is not a valid field,+ # but model_group_retry_policy is, which also tests nested dict serialization)router_settings_data = {"routing_strategy": "usage-based","num_retries": 3,- "retry_policy": {"max_retries": 5},+ "model_group_retry_policy": {"max_retries": 5},}request_data = GenerateKeyRequest(@@ -3722,17 +3725,17 @@ async def test_generate_key_with_router_settings(monkeypatch):assert "router_settings" in key_data# router_settings should be present in the data passed to insert_data- # Note: insert_data may call jsonify_object which serializes dicts to JSON strings- # So router_settings could be either a dict (before jsonify_object) or a JSON string (after)+ # The code uses safe_dumps to serialize router_settings, so it will be a JSON stringrouter_settings_value = key_data["router_settings"]# Get the actual settings value for comparison+ # The code uses safe_dumps to serialize and yaml.safe_load to deserializeif isinstance(router_settings_value, str):- # If it's a JSON string, deserialize it+ # If it's a JSON string (from safe_dumps), deserialize it using json.loads+ # (safe_dumps produces JSON, and json.loads is the correct way to deserialize it)actual_settings = json.loads(router_settings_value)elif isinstance(router_settings_value, dict):# If it's still a dict, use it directly- # (jsonify_object inside insert_data will serialize it before saving to DB)actual_settings = router_settings_valueelse:raise AssertionError(