File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,6 +57,14 @@ user_feed_1.unfollow('flat', '42')
5757following = user_feed_1.following(offset = 0 , limit = 2 )
5858followers = user_feed_1.followers(offset = 0 , limit = 10 )
5959
60+ # Creates many follow relationships in one request
61+ follows = [
62+ {' source' : ' flat:1' , ' target' : ' user:1' },
63+ {' source' : ' flat:1' , ' target' : ' user:2' },
64+ {' source' : ' flat:1' , ' target' : ' user:3' }
65+ ]
66+ client.follow_many(follows)
67+
6068# Batch adding activities
6169activities = [
6270 {' actor' : 1 , ' verb' : ' tweet' , ' object' : 1 },
Original file line number Diff line number Diff line change @@ -279,6 +279,19 @@ def test_flat_follow_no_copy(self):
279279 time .sleep (10 )
280280 activities = follower .get (limit = 3 )['results' ]
281281 self .assertEqual (activities , [])
282+
283+ def test_flat_follow_copy_one (self ):
284+ feed = getfeed ('user' , 'test_flat_follow_copy_one' )
285+ follower = getfeed ('flat' , 'test_flat_follow_copy_one' )
286+ activity_data = {'actor' : 1 , 'verb' : 'tweet' , 'object' : 1 , 'foreign_id' : 'test:1' }
287+ feed .add_activity (activity_data )['id' ]
288+ activity_data = {'actor' : 1 , 'verb' : 'tweet' , 'object' : 1 , 'foreign_id' : 'test:2' }
289+ feed .add_activity (activity_data )['id' ]
290+ follower .follow (feed .slug , feed .user_id , activity_copy_limit = 1 )
291+ time .sleep (5 )
292+ activities = follower .get (limit = 3 )['results' ]
293+ # verify we get the latest activity
294+ self .assertEqual (activities [0 ]['foreign_id' ], 'test:2' )
282295
283296 def _get_first_aggregated_activity (self , activities ):
284297 try :
You can’t perform that action at this time.
0 commit comments