Exemple #1
0
    def _preRender(self, resource):
        """
        Test helper which executes beforeRender on the given resource.

        This is used on live resources so that they don't start message queue
        timers.
        """
        ctx = WovenContext()
        req = FakeRequest(headers={'host': self.hostname})
        ctx.remember(req, IRequest)
        resource.beforeRender(ctx)
Exemple #2
0
    def _preRender(self, resource):
        """
        Test helper which executes beforeRender on the given resource.

        This is used on live resources so that they don't start message queue
        timers.
        """
        ctx = WovenContext()
        req = FakeRequest(headers={'host': self.hostname})
        ctx.remember(req, IRequest)
        resource.beforeRender(ctx)
Exemple #3
0
        def _renderPage():
            page = MantissaLivePage(FakeWebSite())
            element = LiveElement(stan(tags.span(render=tags.directive('liveElement'))))
            element.setFragmentParent(page)
            element.jsClass = u'Mantissa.Test.Dummy.DummyWidget'
            page.docFactory = stan([tags.span(render=tags.directive('liveglue')), element])

            ctx = WovenContext()
            req = FakeRequest(headers={'host': self.hostname})
            ctx.remember(req, IRequest)
            page.beforeRender(ctx)
            page.renderHTTP(ctx)
            page._messageDeliverer.close()
Exemple #4
0
 def test_jsModuleLocation(self):
     """
     L{GenericNavigationAthenaPage.beforeRender} should should call
     L{xmantissa.website.MantissaLivePage.beforeRender}, which shares its
     Athena JavaScript module location with all other pages that use
     L{xmantissa.cachejs}, and provide links to /__jsmodule__/.
     """
     ctx = WovenContext()
     req = FakeRequest()
     ctx.remember(req, IRequest)
     self.navpage.beforeRender(ctx)
     urlObj = self.navpage.getJSModuleURL('Mantissa')
     self.assertEqual(urlObj.pathList()[0], '__jsmodule__')
Exemple #5
0
        def _renderPage():
            page = MantissaLivePage(FakeWebSite())
            element = LiveElement(
                stan(tags.span(render=tags.directive('liveElement'))))
            element.setFragmentParent(page)
            element.jsClass = u'Mantissa.Test.Dummy.DummyWidget'
            page.docFactory = stan(
                [tags.span(render=tags.directive('liveglue')), element])

            ctx = WovenContext()
            req = FakeRequest(headers={'host': self.hostname})
            ctx.remember(req, IRequest)
            page.beforeRender(ctx)
            page.renderHTTP(ctx)
            page._messageDeliverer.close()
Exemple #6
0
 def test_beforeRenderDelegation(self):
     """
     L{GenericNavigationAthenaPage.beforeRender} should call
     C{beforeRender} on the wrapped fragment, if it's defined, and return
     its result.
     """
     contexts = []
     result = defer.succeed(None)
     def beforeRender(ctx):
         contexts.append(ctx)
         return result
     self.navpage.fragment.beforeRender = beforeRender
     ctx = WovenContext()
     ctx.remember(FakeRequest(), IRequest)
     self.assertIdentical(
         self.navpage.beforeRender(ctx), result)
     self.assertEqual(contexts, [ctx])