def setUp(self): self.application = testpages.TestApplication( model.BaseRoot([ testpages.TPageHTMLFileTemplate(), ])) self.pageName = "TPageHTMLFileTemplate" testpages.DummyState.setUp(self)
def setUp(self): state.page = None self.a, self.b = testpages.TPage("test"), testpages.TPage("test") self.s1, self.s2 = testpages.TPage( "end", structural=True), testpages.TPage("end", structural=True) self.p1, self.p2 = testpages.TPage( "sub1", structural=True), testpages.TPage("sub2", structural=True) self.r = model.BaseRoot([ testpages.TPage("base", structural=False, internal=True), [ self.a, testpages.TPage("one", structural=True), [ testpages.TPage("X", structural=False), [ testpages.TPage("two", structural=True, internal=False), [ self.b, ] ] ], self.p1, [ testpages.TPage("page", structural=True), [self.s1], ], self.p2, [testpages.TPage("page", structural=True), [ self.s2, ]], ] ]) self.t = testpages.TestApplication(self.r) state.application = self.t
def test_ambiguoustoplevel(self): r = model.BaseRoot([ testpages.TPage("test", structural=True), testpages.TPage("test", structural=False), ]) tutils.raises(model.exceptions.ApplicationError, testpages.TestApplication, r)
def setUp(self): self.application = testpages.TestApplication( model.BaseRoot([ testpages.TPageHTMLFileTemplate(), [testpages.TPageHTML("nestedpage")], testpages.TPageHTMLTemplate(), ])) self.application.testing = 2
def setUp(self): self.application = testpages.TestApplication( model.BaseRoot([ CMissingMethodLayout("missing"), CLayout("good"), FLayout("flayout"), ])) self.application.testing = 2
def test_ambiguouschild(self): r = model.BaseRoot([ testpages.TPage("one", structural=True), [ testpages.TPage("test"), testpages.TPage("test"), ] ]) tutils.raises(model.ApplicationError, testpages.TestApplication, r)
def test_isDocDescendantOf(self): one = testpages.TPage("one") two = testpages.TPage("two") r = model.BaseRoot([one, testpages.TPage("dir", internal=True), [two]]) t = testpages.TestApplication(r) assert not two.isDescendantOf(one) assert two.isDocDescendantOf(one) assert two.isDocDescendantOf(r) assert r.isDescendantOf(two)
def setUp(self): self.application = testpages.TestApplication( model.BaseRoot([ testpages.TPageHTML("base"), [testpages.TPageNoLink(), testpages.TPageWithTitle()], testpages.TPage("internal", internal=True) ])) self.pageName = "base" testpages.DummyState.setUp(self)
def setUp(self): if not self.application: self.application = model.BaseApplication( model.BaseRoot([TestPage()])) self.application.testing = self.testing if not self.pageName: p = self.application.root.children[0] else: p = self.application.getPage(self.pageName) if not p: p = "Could not find test page." raise model.ApplicationError, p self.application.pre(p)
def test_relativePath(self): self.application = testpages.TestApplication( model.BaseRoot( [testpages.TPageHTML("foo"), [testpages.TPageHTML("bar")]])) p = self.application.getPage(os.path.join("foo", "bar")) assert p.relativePath(["oink"]) == "../oink" assert p.relativePath(["oink", "voing"]) == "../oink/voing" assert p.relativePath(["foo"]) == "../foo" assert p.relativePath([]) == ".." assert p.relativePath(["foo", "bar"]) == "bar" assert p.relativePath(["foo", "bar", "voing"]) == "bar/voing" assert p.absolutePath() == "foo/bar" p = self.application.getPage("foo") assert p.relativePath(["oink"]) == "oink" assert p.relativePath([""]) == "" assert p.relativePath(["foo", "bar"]) == "foo/bar" assert p.absolutePath() == "foo"
def setUp(self): self.application = testpages.TestApplication( model.BaseRoot([ FLayout("flayout"), ])) self.application.testing = 2
def setUp(self): self.r = model.BaseRoot([ TException("one"), ]) self.application = model.BaseApplication(self.r)
testpages.TPage("test", structural=True), testpages.TPage("test", structural=False), ]) tutils.raises(model.ApplicationError, testpages.TestApplication, r) class TException(testpages.TPage): def render(self, *args, **kwargs): raise ValueError("An exception") _TestApp = testpages.TestApplication( model.BaseRoot([ testpages.TPage("one", structural=True), [testpages.TPage("two"), testpages.TPage("three")], testpages.TPage("internal", internal=True), TException("exception"), ])) class TestApplicationRenderNoTesting(testpages.RenderTester): def setUp(self): self.application = _TestApp self.application.testing = 1 def test_prenotesting(self): self.application.testing = 0 p = model.BasePage() self.application.pre(p)