mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
test(e2e): cover created user appearing in /user/list (#34016)
This commit is contained in:
parent
4c77a5433a
commit
68be053e96
3 changed files with 36 additions and 0 deletions
|
|
@ -259,6 +259,17 @@ class ManagementClient:
|
|||
)
|
||||
).total
|
||||
|
||||
def user_list_ids(self, user_id: str) -> tuple[str, ...]:
|
||||
listing = unwrap(
|
||||
self.proxy.transport.get(
|
||||
"/user/list",
|
||||
headers=self.proxy.transport.master,
|
||||
params=UserListParams(user_ids=user_id),
|
||||
response_type=UserListResponse,
|
||||
)
|
||||
)
|
||||
return tuple(row.user_id for row in listing.users)
|
||||
|
||||
def create_org(self, body: OrgNewBody) -> str:
|
||||
return unwrap(
|
||||
self.proxy.transport.post(
|
||||
|
|
|
|||
|
|
@ -277,6 +277,26 @@ class TestUserRoutes:
|
|||
f"/user/info reports user_role {info.user_role!r}, configured 'internal_user'"
|
||||
)
|
||||
|
||||
@pytest.mark.covers("mgmt.user.list.happy_path")
|
||||
def test_created_users_appear_in_user_list(
|
||||
self, client: ManagementClient, resources: ResourceManager
|
||||
) -> None:
|
||||
user_ids = tuple(
|
||||
_create_user(
|
||||
client,
|
||||
resources,
|
||||
UserNewBody(user_email=f"e2e-mgmt-{unique_marker()}@example.com", user_role="internal_user"),
|
||||
)
|
||||
for _ in range(2)
|
||||
)
|
||||
|
||||
for user_id in user_ids:
|
||||
_ = _poll(
|
||||
client,
|
||||
lambda user_id=user_id: (True if user_id in client.user_list_ids(user_id) else None),
|
||||
f"/user/list never listed the created user {user_id} in the admin inventory",
|
||||
)
|
||||
|
||||
|
||||
class TestOrganizationRoutes:
|
||||
@pytest.mark.covers("mgmt.organization.new.happy_path")
|
||||
|
|
|
|||
|
|
@ -699,7 +699,12 @@ class UserListParams(BaseModel):
|
|||
user_ids: str
|
||||
|
||||
|
||||
class UserListRow(BaseModel):
|
||||
user_id: str
|
||||
|
||||
|
||||
class UserListResponse(BaseModel):
|
||||
users: list[UserListRow]
|
||||
total: int
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue