mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-09 22:31:41 +00:00
test(mcp): explain the premium_user patch and tighten the helper docstring
This commit is contained in:
parent
fa4c60562e
commit
0da5cc9653
2 changed files with 4 additions and 2 deletions
|
|
@ -2870,7 +2870,7 @@ def add_guardrails_from_auth_metadata(
|
|||
data: dict, # mutable-ok: writes guardrails into the live request dict, same contract as the helpers it wraps
|
||||
metadata_variable_name: str,
|
||||
) -> None:
|
||||
"""Resolve key, team, and project guardrails (direct and via policies) onto ``data[metadata_variable_name]``."""
|
||||
"""Resolve key, team, and project guardrails, direct and via policies, onto the request metadata."""
|
||||
_add_guardrails_from_key_or_team_metadata(
|
||||
key_metadata=user_api_key_dict.metadata,
|
||||
team_metadata=user_api_key_dict.team_metadata,
|
||||
|
|
|
|||
|
|
@ -1900,7 +1900,9 @@ def test_convert_mcp_to_llm_format_carries_key_and_team_guardrails(key_metadata,
|
|||
}
|
||||
request_obj = proxy_logging._create_mcp_request_object_from_kwargs(kwargs)
|
||||
|
||||
with patch("litellm.proxy.proxy_server.premium_user", True):
|
||||
with patch( # test-quality-ok: the key-guardrail premium gate reads this proxy_server module global and has no injection seam
|
||||
"litellm.proxy.proxy_server.premium_user", True
|
||||
):
|
||||
synthetic = proxy_logging._convert_mcp_to_llm_format(request_obj, kwargs)
|
||||
|
||||
assert guardrail.should_run_guardrail(synthetic, GuardrailEventHooks.pre_mcp_call) is expected_to_run
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue