def test_fetch_discussion_likes(self):

        discussion = DiscussionFactory(id=GROUP_DISCUSSION_WITH_MANY_LIKES1_ID, object_type='GROUP_TOPIC')
        users_initial = User.objects.count()

        users = discussion.fetch_likes(all=True)

        self.assertTrue(discussion.likes_count > 2500)
        self.assertEqual(discussion.likes_count, users.count())
        self.assertEqual(discussion.likes_count, User.objects.count() - users_initial)
        self.assertEqual(discussion.likes_count, discussion.like_users.count())
    def test_fetch_discussion_comments_by_group(self):

        group = GroupFactory(id=GROUP4_ID)
        discussion = DiscussionFactory(owner=group, id=GROUP4_DISCUSSION_WITH_GROUP_COMMENTS_ID, object_type='GROUP_TOPIC')

        self.assertEqual(Comment.objects.count(), 0)

        comments = discussion.fetch_comments(all=True)
        comment = comments.get(author_id=group.id)

        self.assertNotEqual(Comment.objects.count(), 0)
        self.assertEqual(comment.owner, group)
        self.assertEqual(comment.author, group)
    def test_fetch_discussion_comments(self):

        discussion = DiscussionFactory(id=GROUP_DISCUSSION_WITH_MANY_COMMENTS1_ID, object_type='GROUP_TOPIC')

        self.assertEqual(Comment.objects.count(), 0)

        comments = discussion.fetch_comments(all=True)

        self.assertTrue(discussion.comments_count > 2900)
        self.assertEqual(discussion.comments_count, comments.count())
        self.assertEqual(discussion.comments_count, Comment.objects.count())
        self.assertEqual(discussion.comments_count, discussion.comments.count())

        Comment.objects.all().delete()
        discussion = DiscussionFactory(id=GROUP_DISCUSSION_WITH_MANY_COMMENTS2_ID, object_type='GROUP_TOPIC')

        self.assertEqual(Comment.objects.count(), 0)

        comments = discussion.fetch_comments(all=True)

        self.assertTrue(discussion.comments_count > 1900) # now only 1188, but on the site more than 1900
        self.assertEqual(discussion.comments_count, comments.count())
        self.assertEqual(discussion.comments_count, Comment.objects.count())
        self.assertEqual(discussion.comments_count, discussion.comments.count())