forked from phoenix/litellm-mirror
LiteLLM Minor Fixes & Improvements (11/06/2024) (#6624)
* refactor(proxy_server.py): add debug logging around license check event (refactor position in startup_event logic) * fix(proxy/_types.py): allow admin_allowed_routes to be any str * fix(router.py): raise 400-status code error for no 'model_name' error on router Fixes issue with status code when unknown model name passed with pattern matching enabled * fix(converse_handler.py): add claude 3-5 haiku to bedrock converse models * test: update testing to replace claude-instant-1.2 * fix(router.py): fix router.moderation calls * test: update test to remove claude-instant-1 * fix(router.py): support model_list values in router.moderation * test: fix test * test: fix test
This commit is contained in:
parent
136693cac4
commit
0c204d33bc
15 changed files with 180 additions and 130 deletions
|
@ -689,9 +689,10 @@ async def aaaatest_user_token_output(
|
|||
assert team_result.user_id == user_id
|
||||
|
||||
|
||||
@pytest.mark.parametrize("admin_allowed_routes", [None, ["ui_routes"]])
|
||||
@pytest.mark.parametrize("audience", [None, "litellm-proxy"])
|
||||
@pytest.mark.asyncio
|
||||
async def test_allowed_routes_admin(prisma_client, audience):
|
||||
async def test_allowed_routes_admin(prisma_client, audience, admin_allowed_routes):
|
||||
"""
|
||||
Add a check to make sure jwt proxy admin scope can access all allowed admin routes
|
||||
|
||||
|
@ -754,12 +755,17 @@ async def test_allowed_routes_admin(prisma_client, audience):
|
|||
|
||||
jwt_handler.user_api_key_cache = cache
|
||||
|
||||
jwt_handler.litellm_jwtauth = LiteLLM_JWTAuth(team_id_jwt_field="client_id")
|
||||
if admin_allowed_routes:
|
||||
jwt_handler.litellm_jwtauth = LiteLLM_JWTAuth(
|
||||
team_id_jwt_field="client_id", admin_allowed_routes=admin_allowed_routes
|
||||
)
|
||||
else:
|
||||
jwt_handler.litellm_jwtauth = LiteLLM_JWTAuth(team_id_jwt_field="client_id")
|
||||
|
||||
# VALID TOKEN
|
||||
## GENERATE A TOKEN
|
||||
# Assuming the current time is in UTC
|
||||
expiration_time = int((datetime.utcnow() + timedelta(minutes=10)).timestamp())
|
||||
expiration_time = int((datetime.now() + timedelta(minutes=10)).timestamp())
|
||||
|
||||
# Generate the JWT token
|
||||
# But before, you should convert bytes to string
|
||||
|
@ -777,6 +783,7 @@ async def test_allowed_routes_admin(prisma_client, audience):
|
|||
|
||||
# verify token
|
||||
|
||||
print(f"admin_token: {admin_token}")
|
||||
response = await jwt_handler.auth_jwt(token=admin_token)
|
||||
|
||||
## RUN IT THROUGH USER API KEY AUTH
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue