Ejemplo n.º 1
0
 def test_addCommentDispatch(self):
     """
     Test that we can pass a blurb of any flavor to
     L{hyperbola.hyperbola_view.addCommentDispatcher} and then render the
     result
     """
     deferreds = list()
     for flavor in hyperblurb.ALL_FLAVORS:
         proxy = self._shareAndGetProxy(self._makeBlurb(flavor))
         deferreds.append(self._renderFragment(
             hyperbola_view.addCommentDispatcher(
                 hyperbola_view.blurbViewDispatcher(proxy))))
     return defer.gatherResults(deferreds)
Ejemplo n.º 2
0
 def test_addCommentDispatch(self):
     """
     Test that we can pass a blurb of any flavor to
     L{hyperbola.hyperbola_view.addCommentDispatcher} and then render the
     result
     """
     deferreds = list()
     for flavor in hyperblurb.ALL_FLAVORS:
         proxy = self._shareAndGetProxy(self._makeBlurb(flavor))
         deferreds.append(
             self._renderFragment(
                 hyperbola_view.addCommentDispatcher(
                     hyperbola_view.blurbViewDispatcher(proxy))))
     return defer.gatherResults(deferreds)
Ejemplo n.º 3
0
    def test_addCommentWithTags(self):
        """
        Same as L{test_addComment}, but specify some tags to be applied to the
        comment
        """
        for flavor in hyperblurb.ALL_FLAVORS:
            share = self._shareAndGetProxy(self._makeBlurb(flavor))

            parent = hyperbola_view.blurbViewDispatcher(share)
            parent.customizeFor(self.role.externalID)

            frag = hyperbola_view.addCommentDispatcher(parent)
            frag.addComment(u'title', u'body!', (u't', u'a', u'gs'))

            (comment,) = share.view(self.role)
            self.assertEquals(set(comment.tags()), set(('t', 'a', 'gs')))
Ejemplo n.º 4
0
    def test_addComment(self):
        """
        Test adding a comment to a blurb of each flavor through
        L{hyperbola.hyperbola_view.addCommentDispatcher}
        """
        for flavor in hyperblurb.ALL_FLAVORS:
            share = self._shareAndGetProxy(self._makeBlurb(flavor))

            parent = hyperbola_view.blurbViewDispatcher(share)
            parent.customizeFor(self.role.externalID)

            frag = hyperbola_view.addCommentDispatcher(parent)
            frag.addComment(u'title', u'body!', ())

            (comment,) = share.view(self.role)
            self.assertEquals(comment.title, 'title')
            self.assertEquals(comment.body, 'body!')
            self.assertEquals(list(comment.tags()), [])
Ejemplo n.º 5
0
    def test_htmlBlurbBody(self):
        """
        Test that we can set and retrieve a blurb body containing HTML through
        the view APIs
        """
        share = self._shareAndGetProxy(
            self._makeBlurb(
                hyperblurb.FLAVOR.BLOG))

        parent = hyperbola_view.blurbViewDispatcher(share)
        parent.customizeFor(self.role.externalID)

        commenter = hyperbola_view.addCommentDispatcher(parent)
        commenter.addComment(u'title', u'<div>body</div>', ())

        (post,) = share.view(self.role)
        postFragment = hyperbola_view.blurbViewDispatcher(post)
        result = postFragment.body(None, None)
        self.assertEqual(flatten(result), '<div>body</div><br />')