diff --git a/stream_chat/tests/test_client.py b/stream_chat/tests/test_client.py index ca800a76..2df7dfd7 100644 --- a/stream_chat/tests/test_client.py +++ b/stream_chat/tests/test_client.py @@ -143,6 +143,18 @@ def test_update_user(self, client: StreamChat): assert "users" in response assert user["id"] in response["users"] + def test_update_user_with_team(self, client: StreamChat): + user = { + "id": str(uuid.uuid4()), + "team": "blue", + "teams_role": {"blue": "admin"}, + } + response = client.upsert_user(user) + assert "users" in response + assert user["id"] in response["users"] + assert response["users"][user["id"]]["team"] == "blue" + assert response["users"][user["id"]]["teams_role"]["blue"] == "admin" + def test_update_users(self, client: StreamChat): user = {"id": str(uuid.uuid4())} response = client.upsert_users([user]) @@ -161,6 +173,19 @@ def test_update_user_partial(self, client: StreamChat): assert user_id in response["users"] assert response["users"][user_id]["field"] == "updated" + def test_update_user_partial_with_team(self, client: StreamChat): + user_id = str(uuid.uuid4()) + client.upsert_user({"id": user_id, "name": "Test User"}) + + response = client.update_user_partial( + {"id": user_id, "set": {"team": "blue", "teams_role": {"blue": "admin"}}} + ) + + assert "users" in response + assert user_id in response["users"] + assert response["users"][user_id]["team"] == "blue" + assert response["users"][user_id]["teams_role"]["blue"] == "admin" + def test_delete_user(self, client: StreamChat, random_user: Dict): response = client.delete_user(random_user["id"]) assert "user" in response