mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
style: apply Black formatting
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b88726a07e
commit
43a06ab573
2 changed files with 22 additions and 20 deletions
|
|
@ -81,9 +81,9 @@ def _update_internal_new_user_params(data_json: dict, data: NewUserRequest) -> d
|
|||
auto_create_key = data_json.pop("auto_create_key", True)
|
||||
|
||||
if auto_create_key is False:
|
||||
data_json[
|
||||
"table_name"
|
||||
] = "user" # only create a user, don't create key if 'auto_create_key' set to False
|
||||
data_json["table_name"] = (
|
||||
"user" # only create a user, don't create key if 'auto_create_key' set to False
|
||||
)
|
||||
|
||||
if litellm.default_internal_user_params and (
|
||||
data.user_role != LitellmUserRoles.PROXY_ADMIN.value
|
||||
|
|
@ -1121,9 +1121,9 @@ def _update_internal_user_params(
|
|||
"budget_duration" not in non_default_values
|
||||
): # applies internal user limits, if user role updated
|
||||
if is_internal_user and litellm.internal_user_budget_duration is not None:
|
||||
non_default_values[
|
||||
"budget_duration"
|
||||
] = litellm.internal_user_budget_duration
|
||||
non_default_values["budget_duration"] = (
|
||||
litellm.internal_user_budget_duration
|
||||
)
|
||||
from litellm.proxy.common_utils.timezone_utils import get_budget_reset_time
|
||||
|
||||
non_default_values["budget_reset_at"] = get_budget_reset_time(
|
||||
|
|
@ -2384,13 +2384,13 @@ async def ui_view_users(
|
|||
}
|
||||
|
||||
# Query users with pagination and filters
|
||||
users: Optional[
|
||||
List[BaseModel]
|
||||
] = await prisma_client.db.litellm_usertable.find_many(
|
||||
where=where_conditions,
|
||||
skip=skip,
|
||||
take=page_size,
|
||||
order={"created_at": "desc"},
|
||||
users: Optional[List[BaseModel]] = (
|
||||
await prisma_client.db.litellm_usertable.find_many(
|
||||
where=where_conditions,
|
||||
skip=skip,
|
||||
take=page_size,
|
||||
order={"created_at": "desc"},
|
||||
)
|
||||
)
|
||||
|
||||
if not users:
|
||||
|
|
|
|||
|
|
@ -2591,9 +2591,9 @@ async def test_new_user_password_is_hashed_and_stored(mocker):
|
|||
|
||||
# Password must NOT be passed to generate_key_helper_fn
|
||||
call_kwargs = mock_generate_key.call_args.kwargs
|
||||
assert "password" not in call_kwargs, (
|
||||
"password should be popped before calling generate_key_helper_fn"
|
||||
)
|
||||
assert (
|
||||
"password" not in call_kwargs
|
||||
), "password should be popped before calling generate_key_helper_fn"
|
||||
|
||||
# Password must be stored via a separate update call with the correct args
|
||||
mock_update.assert_called_once()
|
||||
|
|
@ -2602,12 +2602,14 @@ async def test_new_user_password_is_hashed_and_stored(mocker):
|
|||
stored_password = call_kwargs.kwargs["data"]["password"]
|
||||
|
||||
# Must NOT be stored as plaintext
|
||||
assert stored_password != plaintext_password, "Password must not be stored as plaintext"
|
||||
assert (
|
||||
stored_password != plaintext_password
|
||||
), "Password must not be stored as plaintext"
|
||||
|
||||
# Must be verifiable
|
||||
assert verify_password(plaintext_password, stored_password), (
|
||||
"Stored password hash must verify against the original plaintext"
|
||||
)
|
||||
assert verify_password(
|
||||
plaintext_password, stored_password
|
||||
), "Stored password hash must verify against the original plaintext"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue