Skip to content

fix(tests): set premium_user=True in test_aasync_call_with_key_over_model_budget#21668

Merged
jquinter merged 1 commit intomainfrom
fix/model-max-budget-test-needs-premium-user
Feb 20, 2026
Merged

fix(tests): set premium_user=True in test_aasync_call_with_key_over_model_budget#21668
jquinter merged 1 commit intomainfrom
fix/model-max-budget-test-needs-premium-user

Conversation

@jquinter
Copy link
Contributor

Summary

  • test_aasync_call_with_key_over_model_budget (all 3 parametrized variants) was failing because generate_key_fn calls validate_model_max_budget, which raises "You must have an enterprise license to set model_max_budget" when premium_user is not True
  • The enterprise gate fires before the test can exercise the actual per-model budget logic, so:
    • [gpt-4o-mini-False] / [openai/gpt-4o-mini-False]: got an enterprise error instead of "exceeded budget for model=..."
    • [gpt-4o-True]: caught the enterprise exception in the except block, triggering assert (should_pass is False) which failed because should_pass=True
  • Fix: add setattr(litellm.proxy.proxy_server, "premium_user", True) alongside the other proxy-server setatrs at the top of the test, matching the pattern used in JWT tests (PR fix(tests): set premium_user=True in JWT tests that call user_api_key_auth #21641)

Not related to PR #21107 (bedrock) or PR #21664 (pricing JSON).

Test plan

🤖 Generated with Claude Code

…odel_budget

generate_key_fn calls validate_model_max_budget which raises
"You must have an enterprise license to set model_max_budget" unless
premium_user=True. The test was hitting this gate before it could
exercise the actual per-model budget logic, causing all three variants
to fail with an enterprise-check error instead of the expected budget
exceeded / pass-through result.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Feb 20, 2026 2:14pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 20, 2026

Greptile Summary

Added premium_user=True flag to test_aasync_call_with_key_over_model_budget to bypass enterprise license check in validate_model_max_budget. The test was failing because the enterprise gate was triggered before the actual per-model budget logic could be exercised. This follows the same pattern established in PR #21641 for JWT tests.

Confidence Score: 5/5

Important Files Changed

Filename Overview
tests/proxy_unit_tests/test_key_generate_prisma.py Added premium_user=True flag to fix enterprise license check in test

Last reviewed commit: 1f63036

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@jquinter jquinter merged commit eb27815 into main Feb 20, 2026
19 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant