This commit is contained in:
willbird1936-dev 2026-08-27 17:52:06 -05:00 committed by GitHub
commit ffb1fcfc21
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 31 additions and 0 deletions

View file

@ -381,6 +381,7 @@ async def health_services_endpoint(
type="user_budget",
user_info=user_info,
)
return {"status": "success", "message": "Mock webhook alert sent"}
elif service == "sqs":
from litellm.integrations.sqs import SQSLogger

View file

@ -264,6 +264,36 @@ async def test_health_services_endpoint_sqs(status, error_message):
mock_instance.async_health_check.assert_awaited_once()
@pytest.mark.asyncio
async def test_health_services_endpoint_webhook_returns_structured_response():
"""
Regression test: the /health/services webhook branch called
proxy_logging_obj.budget_alerts() but had no return statement, so
execution fell through to the end of the function and returned None
(serialized as JSON null with HTTP 200) instead of a structured
{"status": ..., "message": ...} dict like every other service branch.
"""
user_api_key_dict = UserAPIKeyAuth(
token="test-token",
user_id="test-user",
key_alias="test-key-alias",
team_id="test-team",
)
mock_budget_alerts = AsyncMock()
with patch(
"litellm.proxy.proxy_server.proxy_logging_obj.budget_alerts",
mock_budget_alerts,
):
result = await health_services_endpoint(
user_api_key_dict=user_api_key_dict,
service="webhook",
)
mock_budget_alerts.assert_awaited_once()
assert result == {"status": "success", "message": "Mock webhook alert sent"}
@pytest.mark.asyncio
async def test_health_license_endpoint_with_active_license():
license_data = {