mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
Merge f04337030a into 44d84360fb
This commit is contained in:
commit
ffb1fcfc21
2 changed files with 31 additions and 0 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue