@@ -14,6 +14,15 @@ def test_mute_user(self, client, random_users):
1414 assert response ["mute" ]["user" ]["id" ] == random_users [1 ]["id" ]
1515 client .unmute_user (random_users [0 ]["id" ], random_users [1 ]["id" ])
1616
17+ def test_get_message (self , client , channel , random_user ):
18+ msg_id = str (uuid .uuid4 ())
19+ channel .send_message ({"id" : msg_id , "text" : "helloworld" }, random_user ["id" ])
20+ client .delete_message (msg_id )
21+ msg_id = str (uuid .uuid4 ())
22+ channel .send_message ({"id" : msg_id , "text" : "helloworld" }, random_user ["id" ])
23+ message = client .get_message (msg_id )
24+ assert message ["message" ]["id" ] == msg_id
25+
1726 def test_auth_exception (self ):
1827 client = StreamChat (api_key = "bad" , api_secret = "guy" )
1928 with pytest .raises (StreamAPIException ):
@@ -34,6 +43,7 @@ def test_update_channel_type(self, client):
3443
3544 def test_create_token (self , client ):
3645 token = client .create_token ("tommaso" )
46+ assert type (token ) is str
3747 payload = jwt .decode (token , client .api_secret , algorithms = ["HS256" ])
3848 assert payload .get ("user_id" ) == "tommaso"
3949
@@ -56,13 +66,10 @@ def test_update_users(self, client):
5666 def test_update_user_partial (self , client ):
5767 user_id = str (uuid .uuid4 ())
5868 client .update_user ({"id" : user_id , "field" : "value" })
59-
60- response = client .update_user_partial ({
61- "id" : user_id ,
62- "set" : {
63- "field" : "updated"
64- }
65- })
69+
70+ response = client .update_user_partial (
71+ {"id" : user_id , "set" : {"field" : "updated" }}
72+ )
6673
6774 assert "users" in response
6875 assert user_id in response ["users" ]
@@ -129,7 +136,7 @@ def test_delete_message(self, client, channel, random_user):
129136 client .delete_message (msg_id )
130137 msg_id = str (uuid .uuid4 ())
131138 channel .send_message ({"id" : msg_id , "text" : "helloworld" }, random_user ["id" ])
132- resp = client .delete_message (msg_id , hard = True )
139+ client .delete_message (msg_id , hard = True )
133140
134141 def test_flag_message (self , client , channel , random_user , server_user ):
135142 msg_id = str (uuid .uuid4 ())
@@ -163,26 +170,27 @@ def test_devices(self, client, random_user):
163170
164171 def test_search (self , client , channel , random_user ):
165172 query = "supercalifragilisticexpialidocious"
166- channel .send_message ({"text" : "How many syllables are there in {}?" .format (query )}, random_user ['id' ])
167- channel .send_message ({"text" : "Does 'cious' count as one or two?" }, random_user ['id' ])
173+ channel .send_message (
174+ {"text" : "How many syllables are there in {}?" .format (query )},
175+ random_user ["id" ],
176+ )
177+ channel .send_message (
178+ {"text" : "Does 'cious' count as one or two?" }, random_user ["id" ]
179+ )
168180 response = client .search (
169- {"type" : "messaging" },
170- query ,
171- ** {"limit" : 2 , "offset" : 0 }
181+ {"type" : "messaging" }, query , ** {"limit" : 2 , "offset" : 0 }
172182 )
173183 # searches all channels so make sure at least one is found
174- assert len (response [' results' ]) >= 1
175- assert query in response [' results' ][0 ][' message' ][ ' text' ]
184+ assert len (response [" results" ]) >= 1
185+ assert query in response [" results" ][0 ][" message" ][ " text" ]
176186 response = client .search (
177- {"type" : "messaging" },
178- "cious" ,
179- ** {"limit" : 12 , "offset" : 0 })
180- for message in response ['results' ]:
181- assert query not in message ['message' ]['text' ]
187+ {"type" : "messaging" }, "cious" , ** {"limit" : 12 , "offset" : 0 }
188+ )
189+ for message in response ["results" ]:
190+ assert query not in message ["message" ]["text" ]
182191
183192 def test_query_channels_members_in (self , client , fellowship_of_the_ring ):
184193 response = client .query_channels ({"members" : {"$in" : ["gimli" ]}}, {"id" : 1 })
185194 assert len (response ["channels" ]) == 1
186195 assert response ["channels" ][0 ]["channel" ]["id" ] == "fellowship-of-the-ring"
187196 assert len (response ["channels" ][0 ]["members" ]) == 9
188-
0 commit comments