test(e2e): cover created user appearing in /user/list (#34016)

This commit is contained in:
Yassin Kortam 2026-07-20 14:29:13 -07:00 • committed by GitHub
parent 4c77a5433a
commit 68be053e96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 36 additions and 0 deletions

View file

@ -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(

View file

@ -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")

View file

@ -699,7 +699,12 @@ class UserListParams(BaseModel):
user_ids: str
class UserListRow(BaseModel):
user_id: str
class UserListResponse(BaseModel):
users: list[UserListRow]
total: int