mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
test(test_user_api_key_auth.py): add unit test to ensure end user id as str works
This commit is contained in:
parent
b3b06e9387
commit
59d23d1d84
3 changed files with 19 additions and 1 deletions
|
|
@ -110,7 +110,7 @@ def _set_duration_in_model_call_details(
|
|||
if logging_obj and hasattr(logging_obj, "model_call_details"):
|
||||
logging_obj.model_call_details["llm_api_duration_ms"] = duration_ms
|
||||
else:
|
||||
verbose_logger.warning(
|
||||
verbose_logger.debug(
|
||||
"`logging_obj` not found - unable to track `llm_api_duration_ms"
|
||||
)
|
||||
except Exception as e:
|
||||
|
|
|
|||
|
|
@ -10,3 +10,6 @@ model_list:
|
|||
api_base: http://0.0.0.0:8090
|
||||
timeout: 2
|
||||
num_retries: 0
|
||||
- model_name: gemini-1.5-flash
|
||||
litellm_params:
|
||||
model: gemini/gemini-1.5-flash
|
||||
|
|
|
|||
|
|
@ -862,3 +862,18 @@ async def test_jwt_user_api_key_auth_builder_enforce_rbac(enforce_rbac, monkeypa
|
|||
await _jwt_auth_user_api_key_auth_builder(**args)
|
||||
else:
|
||||
await _jwt_auth_user_api_key_auth_builder(**args)
|
||||
|
||||
|
||||
def test_user_api_key_auth_end_user_str():
|
||||
from litellm.proxy.auth.user_api_key_auth import UserAPIKeyAuth
|
||||
|
||||
user_api_key_args = {
|
||||
"api_key": "sk-1234",
|
||||
"parent_otel_span": None,
|
||||
"user_role": LitellmUserRoles.PROXY_ADMIN,
|
||||
"end_user_id": "1",
|
||||
"user_id": "default_user_id",
|
||||
}
|
||||
|
||||
user_api_key_auth = UserAPIKeyAuth(**user_api_key_args)
|
||||
assert user_api_key_auth.end_user_id == "1"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue