def test_follow_disabled(self): ''' Verify that follows don't show up when you disable them in the settings ''' from user.models import UserNotificationSetting # disable the follow notifications user_id = self.bogus_user.id self.set_setting( user_id, FollowVerb, dict(notify_mobile=False, enabled=False)) # verify that we disabled enabled = UserNotificationSetting.objects.enabled_for( user_id, FollowVerb) self.assertFalse(enabled) notification_feedly = NotificationFeedly() follows = Follow.objects.all()[:10] # clear the feed notification_feed = NotificationFeed(user_id) notification_feed.delete() # make sure that notifications for follows don't show up for follow in follows: follow.user_id = self.bogus_user2.id follow.target_id = user_id follow.created_at = datetime.datetime.now() activity = follow.create_activity() feed = notification_feedly._follow(follow) if feed: assert not feed.contains(activity) # the count should be zero self.assertEqual(notification_feed.count_unseen(), 0)
def test_follow_disabled(self): ''' Verify that follows don't show up when you disable them in the settings ''' from user.models import UserNotificationSetting # disable the follow notifications user_id = self.bogus_user.id self.set_setting(user_id, FollowVerb, dict(notify_mobile=False, enabled=False)) # verify that we disabled enabled = UserNotificationSetting.objects.enabled_for( user_id, FollowVerb) self.assertFalse(enabled) notification_feedly = NotificationFeedly() follows = Follow.objects.all()[:10] # clear the feed notification_feed = NotificationFeed(user_id) notification_feed.delete() # make sure that notifications for follows don't show up for follow in follows: follow.user_id = self.bogus_user2.id follow.target_id = user_id follow.created_at = datetime.datetime.now() activity = follow.create_activity() feed = notification_feedly._follow(follow) if feed: assert not feed.contains(activity) # the count should be zero self.assertEqual(notification_feed.count_unseen(), 0)
def test_follow(self): notification_feedly = NotificationFeedly() follows = Follow.objects.all()[:10] notification_feed = NotificationFeed(self.bogus_user.id) notification_feed.delete() for follow in follows: follow.user_id = self.bogus_user2.id follow.target_id = self.bogus_user.id follow.created_at = datetime.datetime.now() activity = follow.create_activity() feed = notification_feedly._follow(follow) assert feed.contains(activity) # influencer feed self.assertEqual(notification_feed.count_unseen(), 1)
def test_follow(self): notification_feedly = NotificationFeedly() follows = Follow.objects.all()[:10] notification_feed = NotificationFeed(self.bogus_user.id) notification_feed.delete() for follow in follows: follow.user_id = self.bogus_user2.id follow.target_id = self.bogus_user.id follow.created_at = datetime.datetime.now() activity = follow.create_activity() feed = notification_feedly._follow(follow) assert feed.contains(activity) # influencer feed self.assertEqual(notification_feed.count_unseen(), 1)
def notification_follow(follow): from feedly.feed_managers.notification_feedly import NotificationFeedly feedly = NotificationFeedly() feedly._follow(follow)
def notification_follow(follow): from feedly.feed_managers.notification_feedly import NotificationFeedly feedly = NotificationFeedly() feedly._follow(follow)