示例#1
0
 def test_offeringChild(self):
     """
     Installing an offering makes its shared items accessible under a child
     of L{_PublicFrontPage} with the offering's name.
     """
     frontPage = FrontPage(store=self.siteStore)
     resource = _PublicFrontPage(frontPage, self.webViewer)
     request = FakeRequest()
     result, segments = resource.locateChild(request, ("test_offering",))
     self.assertIdentical(result.userStore, self.substore)
     self.assertTrue(IWebViewer.providedBy(result.webViewer))
示例#2
0
 def test_offeringChild(self):
     """
     Installing an offering makes its shared items accessible under a child
     of L{_PublicFrontPage} with the offering's name.
     """
     frontPage = FrontPage(store=self.siteStore)
     resource = _PublicFrontPage(frontPage, self.webViewer)
     request = FakeRequest()
     result, segments = resource.locateChild(request, ('test_offering', ))
     self.assertIdentical(result.userStore, self.substore)
     self.assertTrue(IWebViewer.providedBy(result.webViewer))
示例#3
0
 def test_rootChild(self):
     """
     When no default offering has been selected,
     L{PublicFrontPage.locateChild} returns an L{_OfferingsFragment} wrapped by
     the L{IWebViewer}.
     """
     frontPage = FrontPage(store=self.siteStore)
     resource = _PublicFrontPage(frontPage, self.webViewer)
     request = FakeRequest()
     ctx = context.WebContext()
     ctx.remember(request, inevow.IRequest)
     result, segments = resource.locateChild(ctx, ("",))
     self.assertIsInstance(result, PublicPage)
     self.assertIsInstance(result.fragment, _OfferingsFragment)
示例#4
0
 def test_rootChild(self):
     """
     When no default offering has been selected,
     L{PublicFrontPage.locateChild} returns an L{_OfferingsFragment} wrapped by
     the L{IWebViewer}.
     """
     frontPage = FrontPage(store=self.siteStore)
     resource = _PublicFrontPage(frontPage, self.webViewer)
     request = FakeRequest()
     ctx = context.WebContext()
     ctx.remember(request, inevow.IRequest)
     result, segments = resource.locateChild(ctx, ('', ))
     self.assertIsInstance(result, PublicPage)
     self.assertIsInstance(result.fragment, _OfferingsFragment)
示例#5
0
    def test_nonExistentChild(self):
        """
        L{_PublicFrontPage.locateChild} returns L{rend.NotFound} for a child
        segment which does not exist.
        """
        store = Store()
        frontPage = FrontPage(store=store)
        resource = _PublicFrontPage(frontPage, IWebViewer(self.siteStore))

        request = FakeRequest()
        ctx = context.WebContext()
        ctx.remember(request, inevow.IRequest)

        result = resource.locateChild(ctx, ("foo",))
        self.assertIdentical(result, rend.NotFound)
示例#6
0
    def test_nonExistentChild(self):
        """
        L{_PublicFrontPage.locateChild} returns L{rend.NotFound} for a child
        segment which does not exist.
        """
        store = Store()
        frontPage = FrontPage(store=store)
        resource = _PublicFrontPage(frontPage, IWebViewer(self.siteStore))

        request = FakeRequest()
        ctx = context.WebContext()
        ctx.remember(request, inevow.IRequest)

        result = resource.locateChild(ctx, ('foo', ))
        self.assertIdentical(result, rend.NotFound)