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))
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))
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)
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)
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)
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)