@@ -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,23 @@ 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 ,
182+ "set" : {
183+ "team" : "blue" ,
184+ "teams_role" : {"blue" : "admin" }
185+ }
186+ })
187+
188+ assert "users" in response
189+ assert user_id in response ["users" ]
190+ assert response ["users" ][user_id ]["team" ] == "blue"
191+ assert response ["users" ][user_id ]["teams_role" ]["blue" ] == "admin"
192+
164193 def test_delete_user (self , client : StreamChat , random_user : Dict ):
165194 response = client .delete_user (random_user ["id" ])
166195 assert "user" in response
0 commit comments