Skip to content

Commit 014a485

Browse files
committed
Add test for change_activity_to
1 parent 56e83b5 commit 014a485

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎stream/tests.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,23 @@ def test_do_i_follow(self):
565565
self.assertEqual(followings['results'][0]['feed_id'], social.id)
566566
self.assertEqual(followings['results'][0]['target_id'], 'user:apy')
567567

568+
def test_change_activity_to(self):
569+
activity_data = {'actor': 1, 'verb': 'tweet', 'object': 1}
570+
activity_data['to'] = ['user:1', 'user:2']
571+
activity_id = self.user1.add_activity(activity_data)['id']
572+
573+
ret = self.user1.change_activity_to(activity_id, replace=['user:3', 'user:2'])
574+
self.assertEqual(len(ret['activity']['to']), 2)
575+
self.assertIn('user:2', ret['activity']['to'])
576+
self.assertIn('user:3', ret['activity']['to'])
577+
578+
ret = self.user1.change_activity_to(activity_id, add=['user:4', 'user:5'], delete=['user:3'])
579+
self.assertEqual(len(ret['activity']['to']), 3)
580+
self.assertIn('user:2', ret['activity']['to'])
581+
self.assertIn('user:4', ret['activity']['to'])
582+
self.assertIn('user:5', ret['activity']['to'])
583+
584+
568585
def test_get(self):
569586
activity_data = {'actor': 1, 'verb': 'tweet', 'object': 1}
570587
activity_id = self.user1.add_activity(activity_data)['id']

0 commit comments

Comments
 (0)