def test_parent_childnode_wasadded(self):
        parent_comment = create_tcomment()
        parent_comment.save()
        parent_node = TCommentNode.add_root(comment=parent_comment)
        comment = create_tcomment()
        comment.save()
        self.request.POST = {'parent': parent_node.pk}
        responses = comment_was_posted.send(sender=comment.__class__,
                                            comment=comment,
                                            request=self.request)

        self._assert_responses_true(responses)
        self.assertEqual(parent_node, comment.node.get_parent())
    def test_parent_childnode_wasadded(self):
        parent_comment = create_tcomment()
        parent_comment.save()
        parent_node = TCommentNode.add_root(comment=parent_comment)
        comment = create_tcomment()
        comment.save()
        self.request.POST = {'parent': parent_node.pk}
        responses = comment_was_posted.send(
            sender=comment.__class__,
            comment=comment,
            request=self.request)

        self._assert_responses_true(responses)
        self.assertEqual(parent_node, comment.node.get_parent())
    def test_noparent_rootnode_wasadded(self):
        comment = create_tcomment()
        comment.save()
        self.request.POST = {'parent': ''}
        responses = comment_was_posted.send(sender=comment.__class__,
                                            comment=comment,
                                            request=self.request)

        self._assert_responses_true(responses)
        self.assertTrue(comment.node.is_root())
    def test_noparent_rootnode_wasadded(self):
        comment = create_tcomment()
        comment.save()
        self.request.POST = {'parent': ''}
        responses = comment_was_posted.send(
            sender=comment.__class__,
            comment=comment,
            request=self.request)

        self._assert_responses_true(responses)
        self.assertTrue(comment.node.is_root())