10
10
11
11
@pytest .mark .incremental
12
12
class TestChannel (object ):
13
- @pytest .mark .asyncio
14
13
async def test_ban_user (
15
14
self , channel : Channel , random_user : Dict , server_user : Dict
16
15
):
@@ -23,7 +22,6 @@ async def test_ban_user(
23
22
)
24
23
await channel .unban_user (random_user ["id" ])
25
24
26
- @pytest .mark .asyncio
27
25
async def test_create_without_id (
28
26
self , client : StreamChatAsync , random_users : List [Dict ]
29
27
):
@@ -35,21 +33,18 @@ async def test_create_without_id(
35
33
await channel .create (random_users [0 ]["id" ])
36
34
assert channel .id is not None
37
35
38
- @pytest .mark .asyncio
39
36
async def test_send_message_with_options (self , channel : Channel , random_user : Dict ):
40
37
response = await channel .send_message (
41
38
{"text" : "hi" }, random_user ["id" ], skip_push = True
42
39
)
43
40
assert "message" in response
44
41
assert response ["message" ]["text" ] == "hi"
45
42
46
- @pytest .mark .asyncio
47
43
async def test_send_event (self , channel : Channel , random_user : Dict ):
48
44
response = await channel .send_event ({"type" : "typing.start" }, random_user ["id" ])
49
45
assert "event" in response
50
46
assert response ["event" ]["type" ] == "typing.start"
51
47
52
- @pytest .mark .asyncio
53
48
async def test_send_reaction (self , channel : Channel , random_user : Dict ):
54
49
msg = await channel .send_message ({"text" : "hi" }, random_user ["id" ])
55
50
response = await channel .send_reaction (
@@ -59,7 +54,6 @@ async def test_send_reaction(self, channel: Channel, random_user: Dict):
59
54
assert len (response ["message" ]["latest_reactions" ]) == 1
60
55
assert response ["message" ]["latest_reactions" ][0 ]["type" ] == "love"
61
56
62
- @pytest .mark .asyncio
63
57
async def test_delete_reaction (self , channel : Channel , random_user : Dict ):
64
58
msg = await channel .send_message ({"text" : "hi" }, random_user ["id" ])
65
59
await channel .send_reaction (
@@ -71,13 +65,11 @@ async def test_delete_reaction(self, channel: Channel, random_user: Dict):
71
65
assert "message" in response
72
66
assert len (response ["message" ]["latest_reactions" ]) == 0
73
67
74
- @pytest .mark .asyncio
75
68
async def test_update (self , channel : Channel ):
76
69
response = await channel .update ({"motd" : "one apple a day..." })
77
70
assert "channel" in response
78
71
assert response ["channel" ]["motd" ] == "one apple a day..."
79
72
80
- @pytest .mark .asyncio
81
73
async def test_update_partial (self , channel : Channel ):
82
74
response = await channel .update ({"color" : "blue" , "age" : 30 })
83
75
assert "channel" in response
@@ -91,18 +83,15 @@ async def test_update_partial(self, channel: Channel):
91
83
assert response ["channel" ]["color" ] == "red"
92
84
assert "age" not in response ["channel" ]
93
85
94
- @pytest .mark .asyncio
95
86
async def test_delete (self , channel : Channel ):
96
87
response = await channel .delete ()
97
88
assert "channel" in response
98
89
assert response ["channel" ].get ("deleted_at" ) is not None
99
90
100
- @pytest .mark .asyncio
101
91
async def test_truncate (self , channel : Channel ):
102
92
response = await channel .truncate ()
103
93
assert "channel" in response
104
94
105
- @pytest .mark .asyncio
106
95
async def test_truncate_with_options (self , channel : Channel , random_user : Dict ):
107
96
response = await channel .truncate (
108
97
skip_push = True ,
@@ -113,7 +102,6 @@ async def test_truncate_with_options(self, channel: Channel, random_user: Dict):
113
102
)
114
103
assert "channel" in response
115
104
116
- @pytest .mark .asyncio
117
105
async def test_add_members (self , channel : Channel , random_user : Dict ):
118
106
response = await channel .remove_members ([random_user ["id" ]])
119
107
assert len (response ["members" ]) == 0
@@ -122,15 +110,13 @@ async def test_add_members(self, channel: Channel, random_user: Dict):
122
110
assert len (response ["members" ]) == 1
123
111
assert not response ["members" ][0 ].get ("is_moderator" , False )
124
112
125
- @pytest .mark .asyncio
126
113
async def test_add_members_with_options (self , channel : Channel , random_user : Dict ):
127
114
response = await channel .remove_members ([random_user ["id" ]])
128
115
assert len (response ["members" ]) == 0
129
116
130
117
response = await channel .add_members ([random_user ["id" ]], hide_history = True )
131
118
assert len (response ["members" ]) == 1
132
119
133
- @pytest .mark .asyncio
134
120
async def test_invite_members (self , channel : Channel , random_user : Dict ):
135
121
response = await channel .remove_members ([random_user ["id" ]])
136
122
assert len (response ["members" ]) == 0
@@ -139,15 +125,13 @@ async def test_invite_members(self, channel: Channel, random_user: Dict):
139
125
assert len (response ["members" ]) == 1
140
126
assert response ["members" ][0 ].get ("invited" , True )
141
127
142
- @pytest .mark .asyncio
143
128
async def test_add_moderators (self , channel : Channel , random_user : Dict ):
144
129
response = await channel .add_moderators ([random_user ["id" ]])
145
130
assert response ["members" ][0 ]["is_moderator" ]
146
131
147
132
response = await channel .demote_moderators ([random_user ["id" ]])
148
133
assert not response ["members" ][0 ].get ("is_moderator" , False )
149
134
150
- @pytest .mark .asyncio
151
135
async def test_assign_roles_moderators (self , channel : Channel , random_user : Dict ):
152
136
member = {"user_id" : random_user ["id" ], "channel_role" : "channel_moderator" }
153
137
response = await channel .add_members ([member ])
@@ -159,13 +143,11 @@ async def test_assign_roles_moderators(self, channel: Channel, random_user: Dict
159
143
assert len (response ["members" ]) == 1
160
144
assert response ["members" ][0 ]["channel_role" ] == "channel_member"
161
145
162
- @pytest .mark .asyncio
163
146
async def test_mark_read (self , channel : Channel , random_user : Dict ):
164
147
response = await channel .mark_read (random_user ["id" ])
165
148
assert "event" in response
166
149
assert response ["event" ]["type" ] == "message.read"
167
150
168
- @pytest .mark .asyncio
169
151
async def test_get_replies (self , channel : Channel , random_user : Dict ):
170
152
msg = await channel .send_message ({"text" : "hi" }, random_user ["id" ])
171
153
response = await channel .get_replies (msg ["message" ]["id" ])
@@ -187,7 +169,6 @@ async def test_get_replies(self, channel: Channel, random_user: Dict):
187
169
assert len (response ["messages" ]) == 3
188
170
assert response ["messages" ][0 ]["index" ] == 7
189
171
190
- @pytest .mark .asyncio
191
172
async def test_get_reactions (self , channel : Channel , random_user : Dict ):
192
173
msg = await channel .send_message ({"text" : "hi" }, random_user ["id" ])
193
174
response = await channel .get_reactions (msg ["message" ]["id" ])
@@ -211,14 +192,12 @@ async def test_get_reactions(self, channel: Channel, random_user: Dict):
211
192
212
193
assert response ["reactions" ][0 ]["count" ] == 42
213
194
214
- @pytest .mark .asyncio
215
195
async def test_send_and_delete_file (self , channel : Channel , random_user : Dict ):
216
196
url = "helloworld.jpg"
217
197
resp = await channel .send_file (url , "helloworld.jpg" , random_user )
218
198
assert "helloworld.jpg" in resp ["file" ]
219
199
await channel .delete_file (resp ["file" ])
220
200
221
- @pytest .mark .asyncio
222
201
async def test_send_and_delete_image (self , channel : Channel , random_user : Dict ):
223
202
url = "helloworld.jpg"
224
203
resp = await channel .send_image (
@@ -227,7 +206,6 @@ async def test_send_and_delete_image(self, channel: Channel, random_user: Dict):
227
206
assert "helloworld.jpg" in resp ["file" ]
228
207
await channel .delete_image (resp ["file" ])
229
208
230
- @pytest .mark .asyncio
231
209
async def test_channel_hide_show (
232
210
self , client : StreamChatAsync , channel : Channel , random_users : List [Dict ]
233
211
):
@@ -271,7 +249,6 @@ async def test_channel_hide_show(
271
249
)
272
250
assert len (response ["channels" ]) == 1
273
251
274
- @pytest .mark .asyncio
275
252
async def test_invites (self , client : StreamChatAsync , channel : Channel ):
276
253
members = ["john" , "paul" , "george" , "pete" , "ringo" , "eric" ]
277
254
await client .update_users ([{"id" : m } for m in members ])
@@ -301,7 +278,6 @@ async def test_invites(self, client: StreamChatAsync, channel: Channel):
301
278
# can reject again, noop
302
279
await channel .reject_invite ("eric" )
303
280
304
- @pytest .mark .asyncio
305
281
async def test_query_members (self , client : StreamChatAsync , channel : Channel ):
306
282
members = ["paul" , "george" , "john" , "jessica" , "john2" ]
307
283
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):
319
295
assert response [0 ]["user" ]["id" ] == "jessica"
320
296
assert response [1 ]["user" ]["id" ] == "john2"
321
297
322
- @pytest .mark .asyncio
323
298
async def test_mute_unmute (
324
299
self , client : StreamChatAsync , channel : Channel , random_users : List [Dict ]
325
300
):
@@ -342,7 +317,6 @@ async def test_mute_unmute(
342
317
)
343
318
assert len (response ["channels" ]) == 0
344
319
345
- @pytest .mark .asyncio
346
320
async def test_export_channel_status (
347
321
self , client : StreamChatAsync , channel : Channel
348
322
):
@@ -352,7 +326,6 @@ async def test_export_channel_status(
352
326
with pytest .raises (StreamAPIException , match = r".*Can't find channel.*" ):
353
327
await client .export_channel ("messaging" , str (uuid .uuid4 ()))
354
328
355
- @pytest .mark .asyncio
356
329
async def test_export_channel (
357
330
self , client : StreamChatAsync , channel : Channel , random_users : List [Dict ]
358
331
):
0 commit comments