Skip to content

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]

test(guardrails): grant premium_user for the tagged Mode case in llm_as_a_judge mode-shape test

yuchenga658f200050f
diff --git a/tests/test_litellm/proxy/guardrails/test_llm_as_a_judge.py b/tests/test_litellm/proxy/guardrails/test_llm_as_a_judge.py
index 21f58bcee4b..2c121022cd2 100644
--- a/tests/test_litellm/proxy/guardrails/test_llm_as_a_judge.py
+++ b/tests/test_litellm/proxy/guardrails/test_llm_as_a_judge.py
@@ -156,9 +156,11 @@ def test_initialize_guardrail_preserves_every_mode_shape(
lp: Final = _make_litellm_params(mode=mode)
instance: Final = initialize_guardrail(lp, _make_guardrail_dict())
request_data: Final[dict[str, object]] = {"metadata": {"guardrails": ["g"], "tags": ["judge"]}}
+ premium: Final = patch("litellm.proxy.proxy_server.premium_user", True) # test-quality-ok: no seam for Mode tags
try:
- assert instance.should_run_guardrail(request_data, GuardrailEventHooks.pre_call) is runs_pre_call
- assert instance.should_run_guardrail(request_data, GuardrailEventHooks.post_call) is runs_post_call
+ with premium:
+ assert instance.should_run_guardrail(request_data, GuardrailEventHooks.pre_call) is runs_pre_call
+ assert instance.should_run_guardrail(request_data, GuardrailEventHooks.post_call) is runs_post_call
finally:
litellm.logging_callback_manager.remove_callback_from_all_lists(instance)