@@ -1205,27 +1205,36 @@ def test_reaction_get(self):
12051205 response = self .c .reactions .add (
12061206 "like" , "54a60c1e-4ee3-494b-a1e3-50c06acb5ed4" , "mike"
12071207 )
1208- self .c .reactions .get (response ["reaction" ]["id" ])
1208+ reaction = self .c .reactions .get (response ["id" ])
1209+ self .assertEqual (reaction ["parent" ], "" )
1210+ self .assertEqual (reaction ["data" ], {})
1211+ self .assertEqual (reaction ["latest_children" ], {})
1212+ self .assertEqual (reaction ["children_counts" ], {})
1213+ self .assertEqual (reaction ["activity_id" ], "54a60c1e-4ee3-494b-a1e3-50c06acb5ed4" )
1214+ self .assertEqual (reaction ["kind" ], "like" )
1215+ self .assertIn ("created_at" , reaction )
1216+ self .assertIn ("updated_at" , reaction )
1217+ self .assertIn ("id" , reaction )
12091218
12101219 def test_reaction_update (self ):
12111220 response = self .c .reactions .add (
12121221 "like" , "54a60c1e-4ee3-494b-a1e3-50c06acb5ed4" , "mike"
12131222 )
1214- self .c .reactions .update (response ["reaction" ][ " id" ], {"changed" : True })
1223+ self .c .reactions .update (response ["id" ], {"changed" : True })
12151224
12161225 def test_reaction_delete (self ):
12171226 response = self .c .reactions .add (
12181227 "like" , "54a60c1e-4ee3-494b-a1e3-50c06acb5ed4" , "mike"
12191228 )
1220- self .c .reactions .delete (response ["reaction" ][ " id" ])
1229+ self .c .reactions .delete (response ["id" ])
12211230
12221231 def test_reaction_add_child (self ):
12231232 response = self .c .reactions .add (
12241233 "like" , "54a60c1e-4ee3-494b-a1e3-50c06acb5ed4" , "mike"
12251234 )
1226- self .c .reactions .add_child ("like" , response ["reaction" ][ " id" ], "rob" )
1235+ self .c .reactions .add_child ("like" , response ["id" ], "rob" )
12271236
1228- def test_reaction_filter (self ):
1237+ def test_reaction_filter_random (self ):
12291238 self .c .reactions .filter (
12301239 reaction_id = "54a60c1e-4ee3-494b-a1e3-50c06acb5ed4" ,
12311240 id_lte = "54a60c1e-4ee3-494b-a1e3-50c06acb5ed4" ,
@@ -1237,3 +1246,34 @@ def test_reaction_filter(self):
12371246 self .c .reactions .filter (
12381247 user_id = "mike" , id_lte = "54a60c1e-4ee3-494b-a1e3-50c06acb5ed4"
12391248 )
1249+
1250+ def _first_result_should_be (self , response , element ):
1251+ el = element .copy ()
1252+ el .pop ('duration' )
1253+ self .assertEqual (len (response ["results" ]), 1 )
1254+ self .assertEqual (response ["results" ][0 ], el )
1255+
1256+ def test_reaction_filter (self ):
1257+ activity_id = str (uuid1 ())
1258+ user = str (uuid1 ())
1259+
1260+ response = self .c .reactions .add (
1261+ "like" , activity_id , user
1262+ )
1263+ child = self .c .reactions .add_child (
1264+ "like" , response ["id" ], user
1265+ )
1266+ reaction = self .c .reactions .get (response ["id" ])
1267+ r = self .c .reactions .filter (
1268+ reaction_id = reaction ["id" ],
1269+ )
1270+ self ._first_result_should_be (r , child )
1271+
1272+ r = self .c .reactions .filter (
1273+ activity_id = activity_id ,
1274+ id_lte = reaction ["id" ],
1275+ )
1276+ self ._first_result_should_be (r , reaction )
1277+
1278+ r = self .c .reactions .filter (user_id = user , id_lte = reaction ["id" ])
1279+ self ._first_result_should_be (r , reaction )
0 commit comments