def test_get_comments_view(self):

        number_of_comments = DocumentComment.objects.count()  # (from the canopy)

        response = self.client.get("/api/v2/comments/")
        self.assertEqual(number_of_comments, response.data["count"])

        # moooore comments.
        DocumentCommentFactory.create_batch(50)

        response = self.client.get("/api/v2/comments/")
        self.assertEqual(number_of_comments + 50, response.data["count"])
    def test_moderate_comment_by_approving(self):
        user = UserFactory(username="******", password="******")
        project = ProjectFactory()
        project.users.add(user)
        node = DocumentNodeFactory(project=project)

        comment = DocumentCommentFactory(node=node)

        post_data = {"decision": 1}

        self.assertFalse(comment.has_been_approved_since_most_recent_node_change())

        self.client.login(username="******", password="******")
        response = self.client.put("/api/v2/comments/%s/moderate/" % comment.id, post_data)
        self.assertEqual(response.data["decision"], 1)
        self.assertTrue(comment.has_been_approved_since_most_recent_node_change())