def test_user_follow_unfollow_followers(self): g = NetworkGraph() g.follow('user', 'bernard', 'alex') g.follow('user', 'bernard', 'caroline') g.unfollow('user', 'bernard', 'alex') self.assertEqual(['caroline'], sorted(list(g.get_followers('user', 'bernard'))))
def test_user_follow_unfollow(self): g = NetworkGraph() g.follow('user', u'bernard ☀') self.assertTrue(g.is_following('user', u'bernard ☀')) self.assertIn(u'bernard ☀', g.get_following('user')) g.unfollow('user', u'bernard ☀') self.assertFalse(g.is_following('user', u'bernard ☀')) self.assertNotIn(u'bernard ☀', g.get_following('user'))
def test_tag_follow_unfollow_following(self): g = NetworkGraph() g.follow('tag', 'foo', 'alex') g.follow('tag', 'bar', 'alex') g.unfollow('tag', 'foo', 'alex') self.assertEqual(['bar'], list(g.get_following('tag', 'alex')))
def test_content_follow_unfollow_following(self): g = NetworkGraph() g.follow('content', 'doc1', 'alex') g.follow('content', 'doc2', 'alex') g.unfollow('content', 'doc1', 'alex') self.assertEqual(['doc2'], list(g.get_following('content', 'alex')))