def test_notOtherResources(self): """ C{AboutPlugin} will only respond to about.php, not every page on the site. """ s = Store(self.mktemp()) s.powerUp(self.aboutpage.AboutPlugin(store=s)) s.powerUp(AnonymousSite(store=s)) root = IMantissaSite(s) viewer = StubViewer() result = root.siteProduceResource(FakeRequest(), tuple(['undefined']), viewer) self.assertIdentical(result, None)
def test_adminRedirect(self): """ When the admin redirect is installed on a store, it should return an URL which should redirect to /private. """ s = Store(self.mktemp()) s.powerUp(self.adminpage.RedirectPlugin(store=s)) m = Mantissa() m.installSite(s, u'localhost', u'', False) root = IMantissaSite(s) viewer = StubViewer() result, segments = root.siteProduceResource(FakeRequest(), tuple(['admin.php']), viewer) self.assertEquals(result, URL.fromString("http://localhost/private"))
def test_produceAboutResource(self): """ When C{AboutPlugin} is installed on a site store created by 'axiomatic mantissa', requests for 'about.php' will be responded to by a helpful message wrapped in a shell page. """ s = Store(self.mktemp()) s.powerUp(self.aboutpage.AboutPlugin(store=s)) m = Mantissa() m.installSite(s, u"localhost", u"", False) root = IMantissaSite(s) viewer = StubViewer() result, segments = root.siteProduceResource(FakeRequest(), tuple(['about.php']), viewer) self.assertIdentical(result, viewer.shell) self.assertIsInstance(result.model, self.aboutpage.AboutText)