def test_notifications_cleared(self): """ If a page is using the base Facebook template, any AppNotifications for the current user should be displayed and then removed from the database. """ user = FacebookUserFactory.create() AppNotificationFactory.create(user=user) AppNotificationFactory.create(user=user) eq_(len(user.appnotification_set.all()), 2) with self.activate('en-US'): self.client.fb_login(user) self.client.get(reverse('facebook.base_test')) eq_(len(user.appnotification_set.all()), 0)
def test_app_notifications(self): """If the user is logged in, include all of their app notifications.""" user = FacebookUserFactory.create() notes = [AppNotificationFactory.create(user=user) for x in range(2)] eq_(list(self._app_context(user=user)['app_notifications']), notes)