@@ -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 ):
@@ -56,13 +65,10 @@ def test_update_users(self, client):
5665 def test_update_user_partial (self , client ):
5766 user_id = str (uuid .uuid4 ())
5867 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- })
68+
69+ response = client .update_user_partial (
70+ {"id" : user_id , "set" : {"field" : "updated" }}
71+ )
6672
6773 assert "users" in response
6874 assert user_id in response ["users" ]
@@ -163,26 +169,27 @@ def test_devices(self, client, random_user):
163169
164170 def test_search (self , client , channel , random_user ):
165171 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' ])
172+ channel .send_message (
173+ {"text" : "How many syllables are there in {}?" .format (query )},
174+ random_user ["id" ],
175+ )
176+ channel .send_message (
177+ {"text" : "Does 'cious' count as one or two?" }, random_user ["id" ]
178+ )
168179 response = client .search (
169- {"type" : "messaging" },
170- query ,
171- ** {"limit" : 2 , "offset" : 0 }
180+ {"type" : "messaging" }, query , ** {"limit" : 2 , "offset" : 0 }
172181 )
173182 # 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' ]
183+ assert len (response [" results" ]) >= 1
184+ assert query in response [" results" ][0 ][" message" ][ " text" ]
176185 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' ]
186+ {"type" : "messaging" }, "cious" , ** {"limit" : 12 , "offset" : 0 }
187+ )
188+ for message in response ["results" ]:
189+ assert query not in message ["message" ]["text" ]
182190
183191 def test_query_channels_members_in (self , client , fellowship_of_the_ring ):
184192 response = client .query_channels ({"members" : {"$in" : ["gimli" ]}}, {"id" : 1 })
185193 assert len (response ["channels" ]) == 1
186194 assert response ["channels" ][0 ]["channel" ]["id" ] == "fellowship-of-the-ring"
187195 assert len (response ["channels" ][0 ]["members" ]) == 9
188-
0 commit comments