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: give the new proxy_server-global patches a test-quality reason

Yuneng Jiang5de9fc696190
diff --git a/tests/test_litellm/enterprise/enterprise_callbacks/send_emails/test_endpoints.py b/tests/test_litellm/enterprise/enterprise_callbacks/send_emails/test_endpoints.py
index 1e7492726ed..c2ae153556d 100644
--- a/tests/test_litellm/enterprise/enterprise_callbacks/send_emails/test_endpoints.py
+++ b/tests/test_litellm/enterprise/enterprise_callbacks/send_emails/test_endpoints.py
@@ -291,7 +291,7 @@ async def test_save_email_settings_refuses_a_config_owned_email_settings():
client = _prisma_recording_upserts(upserts)
proxy_config = _proxy_config_owning({"email_settings": {EmailEvent.new_user_invitation.value: True}})
- with mock.patch("litellm.proxy.proxy_server.proxy_config", proxy_config):
+ with mock.patch("litellm.proxy.proxy_server.proxy_config", proxy_config): # test-quality-ok: the endpoint reads these proxy_server module globals at call time; there is no injection seam
with pytest.raises(HTTPException) as refused:
await _save_email_settings(client, {EmailEvent.new_user_invitation.value: False})
@@ -309,8 +309,8 @@ async def test_update_event_settings_surfaces_the_config_owned_refusal(mock_user
settings=[EmailEventSettings(event=EmailEvent.virtual_key_created, enabled=True)]
)
- with mock.patch("litellm.proxy.proxy_server.prisma_client", client):
- with mock.patch("litellm.proxy.proxy_server.proxy_config", proxy_config):
+ with mock.patch("litellm.proxy.proxy_server.prisma_client", client): # test-quality-ok: the endpoint reads these proxy_server module globals at call time; there is no injection seam
+ with mock.patch("litellm.proxy.proxy_server.proxy_config", proxy_config): # test-quality-ok: the endpoint reads these proxy_server module globals at call time; there is no injection seam
with pytest.raises(HTTPException) as refused:
await update_event_settings(request=request, user_api_key_dict=mock_user_api_key_auth)
@@ -325,7 +325,7 @@ async def test_save_email_settings_still_writes_when_the_config_file_is_silent()
client = _prisma_recording_upserts(upserts)
proxy_config = _proxy_config_owning({})
- with mock.patch("litellm.proxy.proxy_server.proxy_config", proxy_config):
+ with mock.patch("litellm.proxy.proxy_server.proxy_config", proxy_config): # test-quality-ok: the endpoint reads these proxy_server module globals at call time; there is no injection seam
await _save_email_settings(client, {EmailEvent.new_user_invitation.value: False})
assert len(upserts) == 1
diff --git a/tests/test_litellm/proxy/config_resolvers/test_settings_store.py b/tests/test_litellm/proxy/config_resolvers/test_settings_store.py
index c3e30341993..ab1bff67c42 100644
--- a/tests/test_litellm/proxy/config_resolvers/test_settings_store.py
+++ b/tests/test_litellm/proxy/config_resolvers/test_settings_store.py
@@ -431,7 +431,7 @@ def test_settings_store_truthiness_stops_at_the_first_key() -> None:
resolutions.append(key)
return original(self, key)
- with patch.object(SettingsStore, "_resolution_for", counted):
+ with patch.object(SettingsStore, "_resolution_for", counted): # test-quality-ok: counting resolutions is the only way to observe that truthiness short-circuits
assert bool(store) is True
truthiness_resolutions: Final = len(resolutions)
resolutions.clear()
diff --git a/tests/test_litellm/proxy/management_endpoints/test_coordination_redis_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_coordination_redis_endpoints.py
index dc703640768..faa8b851db4 100644
--- a/tests/test_litellm/proxy/management_endpoints/test_coordination_redis_endpoints.py
+++ b/tests/test_litellm/proxy/management_endpoints/test_coordination_redis_endpoints.py
@@ -636,9 +636,9 @@ async def test_update_refuses_a_config_owned_coordination_redis_block(monkeypatc
from_file = {"coordination_redis": {"host": "yaml-redis.example.com", "port": 6379}}
with (
- patch("litellm.proxy.proxy_server.prisma_client", mock_prisma),
- patch("litellm.proxy.proxy_server.proxy_config", _real_proxy_config(from_file)),
- patch("litellm.proxy.proxy_server.store_model_in_db", True),
+ patch("litellm.proxy.proxy_server.prisma_client", mock_prisma), # test-quality-ok: the endpoint reads these proxy_server module globals at call time; there is no injection seam
+ patch("litellm.proxy.proxy_server.proxy_config", _real_proxy_config(from_file)), # test-quality-ok: the endpoint reads these proxy_server module globals at call time; there is no injection seam
+ patch("litellm.proxy.proxy_server.store_model_in_db", True), # test-quality-ok: the endpoint reads these proxy_server module globals at call time; there is no injection seam
):
with pytest.raises(HTTPException) as refused:
await update_coordination_redis_settings(
@@ -661,10 +661,10 @@ async def test_update_still_persists_when_the_config_file_declares_no_block(monk
return None
with (
- patch("litellm.proxy.proxy_server.prisma_client", mock_prisma),
- patch("litellm.proxy.proxy_server.proxy_config", _real_proxy_config({"master_key": "sk-1234"})),
- patch("litellm.proxy.proxy_server.store_model_in_db", True),
- patch(
+ patch("litellm.proxy.proxy_server.prisma_client", mock_prisma), # test-quality-ok: the endpoint reads these proxy_server module globals at call time; there is no injection seam
+ patch("litellm.proxy.proxy_server.proxy_config", _real_proxy_config({"master_key": "sk-1234"})), # test-quality-ok: the endpoint reads these proxy_server module globals at call time; there is no injection seam
+ patch("litellm.proxy.proxy_server.store_model_in_db", True), # test-quality-ok: the endpoint reads these proxy_server module globals at call time; there is no injection seam
+ patch( # test-quality-ok: the endpoint reads these proxy_server module globals at call time; there is no injection seam
"litellm.proxy.management_endpoints.coordination_redis_endpoints.invalidate_config_param",
new=_capture_invalidate,
),