Skip to content

Commit b9f0a73

Browse files
[CHA-662] - Support for team based roles (#194)
* added tests for team based roles * Update stream_chat/tests/test_client.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update stream_chat/tests/test_client.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 690484a commit b9f0a73

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

stream_chat/tests/test_client.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,18 @@ def test_update_user(self, client: StreamChat):
143143
assert "users" in response
144144
assert user["id"] in response["users"]
145145

146+
def test_update_user_with_team(self, client: StreamChat):
147+
user = {
148+
"id": str(uuid.uuid4()),
149+
"team": "blue",
150+
"teams_role": {"blue": "admin"},
151+
}
152+
response = client.upsert_user(user)
153+
assert "users" in response
154+
assert user["id"] in response["users"]
155+
assert response["users"][user["id"]]["team"] == "blue"
156+
assert response["users"][user["id"]]["teams_role"]["blue"] == "admin"
157+
146158
def test_update_users(self, client: StreamChat):
147159
user = {"id": str(uuid.uuid4())}
148160
response = client.upsert_users([user])
@@ -161,6 +173,19 @@ def test_update_user_partial(self, client: StreamChat):
161173
assert user_id in response["users"]
162174
assert response["users"][user_id]["field"] == "updated"
163175

176+
def test_update_user_partial_with_team(self, client: StreamChat):
177+
user_id = str(uuid.uuid4())
178+
client.upsert_user({"id": user_id, "name": "Test User"})
179+
180+
response = client.update_user_partial(
181+
{"id": user_id, "set": {"team": "blue", "teams_role": {"blue": "admin"}}}
182+
)
183+
184+
assert "users" in response
185+
assert user_id in response["users"]
186+
assert response["users"][user_id]["team"] == "blue"
187+
assert response["users"][user_id]["teams_role"]["blue"] == "admin"
188+
164189
def test_delete_user(self, client: StreamChat, random_user: Dict):
165190
response = client.delete_user(random_user["id"])
166191
assert "user" in response

0 commit comments

Comments
 (0)