mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 18:24:20 +00:00
_team_key_generation_check
This commit is contained in:
parent
6c9930db5a
commit
28a6d67726
1 changed files with 18 additions and 3 deletions
|
@ -661,6 +661,7 @@ def test_team_key_generation_team_member_check():
|
|||
team_member=Member(role="admin", user_id="test_user_id"),
|
||||
),
|
||||
data=GenerateKeyRequest(),
|
||||
route=KeyManagementRoutes.KEY_GENERATE,
|
||||
)
|
||||
|
||||
team_table = LiteLLM_TeamTableCachedObj(
|
||||
|
@ -679,6 +680,7 @@ def test_team_key_generation_team_member_check():
|
|||
team_member=Member(role="user", user_id="test_user_id"),
|
||||
),
|
||||
data=GenerateKeyRequest(),
|
||||
route=KeyManagementRoutes.KEY_GENERATE,
|
||||
)
|
||||
|
||||
|
||||
|
@ -739,13 +741,26 @@ def test_key_generation_required_params_check(
|
|||
|
||||
if expected_result:
|
||||
if key_type == "team_key":
|
||||
assert _team_key_generation_check(team_table, user_api_key_dict, input_data)
|
||||
assert _team_key_generation_check(
|
||||
team_table=team_table,
|
||||
user_api_key_dict=user_api_key_dict,
|
||||
data=input_data,
|
||||
route=KeyManagementRoutes.KEY_GENERATE,
|
||||
)
|
||||
elif key_type == "personal_key":
|
||||
assert _personal_key_generation_check(user_api_key_dict, input_data)
|
||||
assert _personal_key_generation_check(
|
||||
user_api_key_dict=user_api_key_dict,
|
||||
data=input_data,
|
||||
)
|
||||
else:
|
||||
if key_type == "team_key":
|
||||
with pytest.raises(HTTPException):
|
||||
_team_key_generation_check(team_table, user_api_key_dict, input_data)
|
||||
_team_key_generation_check(
|
||||
team_table=team_table,
|
||||
user_api_key_dict=user_api_key_dict,
|
||||
data=input_data,
|
||||
route=KeyManagementRoutes.KEY_GENERATE,
|
||||
)
|
||||
elif key_type == "personal_key":
|
||||
with pytest.raises(HTTPException):
|
||||
_personal_key_generation_check(user_api_key_dict, input_data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue