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: cover the config-owned refusal on the email reset route

Yuneng Jiang9c3a7133f119
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 c2ae153556d..7b32d9e8c44 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
@@ -331,3 +331,19 @@ async def test_save_email_settings_still_writes_when_the_config_file_is_silent()
assert len(upserts) == 1
written = json.loads(upserts[0]["data"]["create"]["param_value"])
assert written["email_settings"] == {EmailEvent.new_user_invitation.value: False}
+
+
+async def test_reset_event_settings_surfaces_the_config_owned_refusal(mock_user_api_key_auth):
+ upserts = []
+ 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.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 reset_event_settings(user_api_key_dict=mock_user_api_key_auth)
+
+ assert refused.value.status_code == 400
+ assert refused.value.detail["keys"] == ["email_settings"]
+ assert upserts == []