1010
1111@pytest .mark .incremental
1212class TestChannel (object ):
13- @pytest .mark .asyncio
1413 async def test_ban_user (
1514 self , channel : Channel , random_user : Dict , server_user : Dict
1615 ):
@@ -23,7 +22,6 @@ async def test_ban_user(
2322 )
2423 await channel .unban_user (random_user ["id" ])
2524
26- @pytest .mark .asyncio
2725 async def test_create_without_id (
2826 self , client : StreamChatAsync , random_users : List [Dict ]
2927 ):
@@ -35,21 +33,18 @@ async def test_create_without_id(
3533 await channel .create (random_users [0 ]["id" ])
3634 assert channel .id is not None
3735
38- @pytest .mark .asyncio
3936 async def test_send_message_with_options (self , channel : Channel , random_user : Dict ):
4037 response = await channel .send_message (
4138 {"text" : "hi" }, random_user ["id" ], skip_push = True
4239 )
4340 assert "message" in response
4441 assert response ["message" ]["text" ] == "hi"
4542
46- @pytest .mark .asyncio
4743 async def test_send_event (self , channel : Channel , random_user : Dict ):
4844 response = await channel .send_event ({"type" : "typing.start" }, random_user ["id" ])
4945 assert "event" in response
5046 assert response ["event" ]["type" ] == "typing.start"
5147
52- @pytest .mark .asyncio
5348 async def test_send_reaction (self , channel : Channel , random_user : Dict ):
5449 msg = await channel .send_message ({"text" : "hi" }, random_user ["id" ])
5550 response = await channel .send_reaction (
@@ -59,7 +54,6 @@ async def test_send_reaction(self, channel: Channel, random_user: Dict):
5954 assert len (response ["message" ]["latest_reactions" ]) == 1
6055 assert response ["message" ]["latest_reactions" ][0 ]["type" ] == "love"
6156
62- @pytest .mark .asyncio
6357 async def test_delete_reaction (self , channel : Channel , random_user : Dict ):
6458 msg = await channel .send_message ({"text" : "hi" }, random_user ["id" ])
6559 await channel .send_reaction (
@@ -71,13 +65,11 @@ async def test_delete_reaction(self, channel: Channel, random_user: Dict):
7165 assert "message" in response
7266 assert len (response ["message" ]["latest_reactions" ]) == 0
7367
74- @pytest .mark .asyncio
7568 async def test_update (self , channel : Channel ):
7669 response = await channel .update ({"motd" : "one apple a day..." })
7770 assert "channel" in response
7871 assert response ["channel" ]["motd" ] == "one apple a day..."
7972
80- @pytest .mark .asyncio
8173 async def test_update_partial (self , channel : Channel ):
8274 response = await channel .update ({"color" : "blue" , "age" : 30 })
8375 assert "channel" in response
@@ -91,18 +83,15 @@ async def test_update_partial(self, channel: Channel):
9183 assert response ["channel" ]["color" ] == "red"
9284 assert "age" not in response ["channel" ]
9385
94- @pytest .mark .asyncio
9586 async def test_delete (self , channel : Channel ):
9687 response = await channel .delete ()
9788 assert "channel" in response
9889 assert response ["channel" ].get ("deleted_at" ) is not None
9990
100- @pytest .mark .asyncio
10191 async def test_truncate (self , channel : Channel ):
10292 response = await channel .truncate ()
10393 assert "channel" in response
10494
105- @pytest .mark .asyncio
10695 async def test_truncate_with_options (self , channel : Channel , random_user : Dict ):
10796 response = await channel .truncate (
10897 skip_push = True ,
@@ -113,7 +102,6 @@ async def test_truncate_with_options(self, channel: Channel, random_user: Dict):
113102 )
114103 assert "channel" in response
115104
116- @pytest .mark .asyncio
117105 async def test_add_members (self , channel : Channel , random_user : Dict ):
118106 response = await channel .remove_members ([random_user ["id" ]])
119107 assert len (response ["members" ]) == 0
@@ -122,15 +110,13 @@ async def test_add_members(self, channel: Channel, random_user: Dict):
122110 assert len (response ["members" ]) == 1
123111 assert not response ["members" ][0 ].get ("is_moderator" , False )
124112
125- @pytest .mark .asyncio
126113 async def test_add_members_with_options (self , channel : Channel , random_user : Dict ):
127114 response = await channel .remove_members ([random_user ["id" ]])
128115 assert len (response ["members" ]) == 0
129116
130117 response = await channel .add_members ([random_user ["id" ]], hide_history = True )
131118 assert len (response ["members" ]) == 1
132119
133- @pytest .mark .asyncio
134120 async def test_invite_members (self , channel : Channel , random_user : Dict ):
135121 response = await channel .remove_members ([random_user ["id" ]])
136122 assert len (response ["members" ]) == 0
@@ -139,15 +125,13 @@ async def test_invite_members(self, channel: Channel, random_user: Dict):
139125 assert len (response ["members" ]) == 1
140126 assert response ["members" ][0 ].get ("invited" , True )
141127
142- @pytest .mark .asyncio
143128 async def test_add_moderators (self , channel : Channel , random_user : Dict ):
144129 response = await channel .add_moderators ([random_user ["id" ]])
145130 assert response ["members" ][0 ]["is_moderator" ]
146131
147132 response = await channel .demote_moderators ([random_user ["id" ]])
148133 assert not response ["members" ][0 ].get ("is_moderator" , False )
149134
150- @pytest .mark .asyncio
151135 async def test_assign_roles_moderators (self , channel : Channel , random_user : Dict ):
152136 member = {"user_id" : random_user ["id" ], "channel_role" : "channel_moderator" }
153137 response = await channel .add_members ([member ])
@@ -159,13 +143,11 @@ async def test_assign_roles_moderators(self, channel: Channel, random_user: Dict
159143 assert len (response ["members" ]) == 1
160144 assert response ["members" ][0 ]["channel_role" ] == "channel_member"
161145
162- @pytest .mark .asyncio
163146 async def test_mark_read (self , channel : Channel , random_user : Dict ):
164147 response = await channel .mark_read (random_user ["id" ])
165148 assert "event" in response
166149 assert response ["event" ]["type" ] == "message.read"
167150
168- @pytest .mark .asyncio
169151 async def test_get_replies (self , channel : Channel , random_user : Dict ):
170152 msg = await channel .send_message ({"text" : "hi" }, random_user ["id" ])
171153 response = await channel .get_replies (msg ["message" ]["id" ])
@@ -187,7 +169,6 @@ async def test_get_replies(self, channel: Channel, random_user: Dict):
187169 assert len (response ["messages" ]) == 3
188170 assert response ["messages" ][0 ]["index" ] == 7
189171
190- @pytest .mark .asyncio
191172 async def test_get_reactions (self , channel : Channel , random_user : Dict ):
192173 msg = await channel .send_message ({"text" : "hi" }, random_user ["id" ])
193174 response = await channel .get_reactions (msg ["message" ]["id" ])
@@ -211,14 +192,12 @@ async def test_get_reactions(self, channel: Channel, random_user: Dict):
211192
212193 assert response ["reactions" ][0 ]["count" ] == 42
213194
214- @pytest .mark .asyncio
215195 async def test_send_and_delete_file (self , channel : Channel , random_user : Dict ):
216196 url = "helloworld.jpg"
217197 resp = await channel .send_file (url , "helloworld.jpg" , random_user )
218198 assert "helloworld.jpg" in resp ["file" ]
219199 await channel .delete_file (resp ["file" ])
220200
221- @pytest .mark .asyncio
222201 async def test_send_and_delete_image (self , channel : Channel , random_user : Dict ):
223202 url = "helloworld.jpg"
224203 resp = await channel .send_image (
@@ -227,7 +206,6 @@ async def test_send_and_delete_image(self, channel: Channel, random_user: Dict):
227206 assert "helloworld.jpg" in resp ["file" ]
228207 await channel .delete_image (resp ["file" ])
229208
230- @pytest .mark .asyncio
231209 async def test_channel_hide_show (
232210 self , client : StreamChatAsync , channel : Channel , random_users : List [Dict ]
233211 ):
@@ -271,7 +249,6 @@ async def test_channel_hide_show(
271249 )
272250 assert len (response ["channels" ]) == 1
273251
274- @pytest .mark .asyncio
275252 async def test_invites (self , client : StreamChatAsync , channel : Channel ):
276253 members = ["john" , "paul" , "george" , "pete" , "ringo" , "eric" ]
277254 await client .update_users ([{"id" : m } for m in members ])
@@ -301,7 +278,6 @@ async def test_invites(self, client: StreamChatAsync, channel: Channel):
301278 # can reject again, noop
302279 await channel .reject_invite ("eric" )
303280
304- @pytest .mark .asyncio
305281 async def test_query_members (self , client : StreamChatAsync , channel : Channel ):
306282 members = ["paul" , "george" , "john" , "jessica" , "john2" ]
307283 await client .update_users ([{"id" : m , "name" : m } for m in members ])
@@ -319,7 +295,6 @@ async def test_query_members(self, client: StreamChatAsync, channel: Channel):
319295 assert response [0 ]["user" ]["id" ] == "jessica"
320296 assert response [1 ]["user" ]["id" ] == "john2"
321297
322- @pytest .mark .asyncio
323298 async def test_mute_unmute (
324299 self , client : StreamChatAsync , channel : Channel , random_users : List [Dict ]
325300 ):
@@ -342,7 +317,6 @@ async def test_mute_unmute(
342317 )
343318 assert len (response ["channels" ]) == 0
344319
345- @pytest .mark .asyncio
346320 async def test_export_channel_status (
347321 self , client : StreamChatAsync , channel : Channel
348322 ):
@@ -352,7 +326,6 @@ async def test_export_channel_status(
352326 with pytest .raises (StreamAPIException , match = r".*Can't find channel.*" ):
353327 await client .export_channel ("messaging" , str (uuid .uuid4 ()))
354328
355- @pytest .mark .asyncio
356329 async def test_export_channel (
357330 self , client : StreamChatAsync , channel : Channel , random_users : List [Dict ]
358331 ):
0 commit comments