def test_viewlet_not_renders_for_improper_object(self):
     """ Only objects that have their comments enabled should
     show the viewlet
     """
     self.context.allow_discussion = False
     viewlet = CommentsViewlet(self.context, self.request, None, None)
     self.assertFalse(viewlet.is_discussion_allowed())
 def test_viewlet_js_variables_properly_handled(self):
     """ Objects with single quotes in their titles should
         replace it with double quotes
     """
     self.context.setTitle("Title containing 'single quotes'")
     viewlet = CommentsViewlet(self.context, self.request, None, None)
     javascriptvars = viewlet.javascriptvars()
     self.assertTrue('Title containing "single quotes"' in javascriptvars)
    def test_viewlet_renders_for_proper_object(self):
        """ Only objects that have their comments enabled should
        show the viewlet
        """
        self.discussionTool.overrideDiscussionFor(self.portal.doc1, True)

        viewlet = CommentsViewlet(self.context, self.request, None, None)
        self.assertTrue(viewlet.is_discussion_allowed())