mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
fix: initialize jwt_handler.litellm_jwtauth in JWT test
The test_jwt_non_admin_team_route_access test was failing because user_api_key_auth now accesses jwt_handler.litellm_jwtauth.virtual_key_claim_field before reaching the mocked JWTAuthManager.auth_builder. Initialize the jwt_handler with a default LiteLLM_JWTAuth object. Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
This commit is contained in:
parent
6b13ef266c
commit
f748b8cb39
1 changed files with 12 additions and 0 deletions
|
|
@ -1044,6 +1044,18 @@ async def test_jwt_non_admin_team_route_access(monkeypatch):
|
|||
litellm.proxy.proxy_server, "general_settings", {"enable_jwt_auth": True}
|
||||
)
|
||||
|
||||
# Initialize jwt_handler with a default LiteLLM_JWTAuth so that the
|
||||
# virtual_key_claim_field check in user_api_key_auth doesn't fail with
|
||||
# "JWTHandler has no attribute 'litellm_jwtauth'"
|
||||
from litellm.proxy._types import LiteLLM_JWTAuth
|
||||
from litellm.caching.dual_cache import DualCache
|
||||
|
||||
litellm.proxy.proxy_server.jwt_handler.update_environment(
|
||||
prisma_client=None,
|
||||
user_api_key_cache=DualCache(),
|
||||
litellm_jwtauth=LiteLLM_JWTAuth(),
|
||||
)
|
||||
|
||||
# Mock enterprise license check and JWTAuthManager.auth_builder
|
||||
# License check must be mocked to avoid environment variable pollution
|
||||
# in parallel test execution
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue