def test_list_for_admin(self): admin = factory.make_admin() admin2 = factory.make_admin() handler = NotificationHandler(admin, {}, None) notifications = [ factory.make_Notification(user=admin), # Will match. factory.make_Notification(user=admin2), factory.make_Notification(users=True), factory.make_Notification(users=False), factory.make_Notification(admins=True), # Will match. factory.make_Notification(admins=False), ] expected = [ MatchesRenderedNotification(notifications[0]), MatchesRenderedNotification(notifications[4]), ] self.assertThat(handler.list({}), MatchesListwise(expected))
def test_list(self): user = factory.make_User() user2 = factory.make_User() handler = NotificationHandler(user, {}, None) notifications = [ factory.make_Notification(user=user), # Will match. factory.make_Notification(user=user2), factory.make_Notification(users=True), # Will match. factory.make_Notification(users=False), factory.make_Notification(admins=True), factory.make_Notification(admins=False), ] expected = [ MatchesRenderedNotification(notifications[0]), MatchesRenderedNotification(notifications[2]), ] self.assertThat(handler.list({}), MatchesListwise(expected))