mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
test(proxy): cover custom MCP budget message
This commit is contained in:
parent
832eb193ab
commit
72aa5b0b1a
1 changed files with 3 additions and 1 deletions
|
|
@ -5671,15 +5671,17 @@ class TestMCPDcrBridgeDelegateAdmission:
|
|||
)
|
||||
return exc_info.value
|
||||
|
||||
async def test_over_budget_admission_surfaces_429_not_401(self):
|
||||
async def test_over_budget_admission_surfaces_429_not_401(self, monkeypatch):
|
||||
"""A validly-authenticated but over-budget identity surfaces the standard pipeline's 429, not
|
||||
a misleading 401. Flattening budget to 401 told the caller their credential was invalid, which
|
||||
on a DCR client reads as broken auth and triggers a re-authorize that cannot fix a budget
|
||||
problem. Regression for the status-flattening finding on the live-policy gate."""
|
||||
import litellm
|
||||
|
||||
monkeypatch.setattr(litellm, "budget_exceeded_error_message", "Allowance reached")
|
||||
mapped = await self._enforce_with_gate_error(litellm.BudgetExceededError(current_cost=10.0, max_budget=1.0))
|
||||
assert mapped.status_code == 429
|
||||
assert mapped.detail == "Allowance reached"
|
||||
|
||||
async def test_db_outage_during_policy_surfaces_503_not_401(self):
|
||||
"""A transient database outage during the live-policy gate surfaces a retryable 503, not a 401
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue