feat: user ids return on get org users
This commit is contained in:
parent
a215d11df9
commit
607f736453
3 changed files with 8 additions and 3 deletions
|
|
@ -265,7 +265,7 @@ async def get_users(org_model: org_model_root_claim_query_dependency):
|
||||||
Returns a list of the email addresses of all users of the organisation.
|
Returns a list of the email addresses of all users of the organisation.
|
||||||
"""
|
"""
|
||||||
return {
|
return {
|
||||||
"users": [user.email for user in org_model.user_rel],
|
"users": [{"email": user.email, "id": user.id} for user in org_model.user_rel],
|
||||||
"organisation": org_model,
|
"organisation": org_model,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ class OrgPatchRootResponse(CustomBaseModel):
|
||||||
|
|
||||||
|
|
||||||
class OrgGetUserResponse(CustomBaseModel):
|
class OrgGetUserResponse(CustomBaseModel):
|
||||||
users: list[str]
|
users: list[dict[str, str | int]]
|
||||||
organisation: OrgSchema
|
organisation: OrgSchema
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -208,10 +208,15 @@ async def test_get_org_users_success(default_client: AsyncClient):
|
||||||
data = resp.json()
|
data = resp.json()
|
||||||
|
|
||||||
assert resp.status_code == 200
|
assert resp.status_code == 200
|
||||||
|
|
||||||
assert "users" in data
|
assert "users" in data
|
||||||
assert isinstance(data["users"], list)
|
assert isinstance(data["users"], list)
|
||||||
assert len(data["users"]) == 1
|
assert len(data["users"]) == 1
|
||||||
assert data["users"][0] == "admin@test.com"
|
|
||||||
|
user = data["users"][0]
|
||||||
|
assert isinstance(user, dict)
|
||||||
|
assert user["email"] == "admin@test.com"
|
||||||
|
assert user["id"] == 1
|
||||||
|
|
||||||
assert "organisation" in data
|
assert "organisation" in data
|
||||||
assert data["organisation"]["name"] == "Test Org"
|
assert data["organisation"]["name"] == "Test Org"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue