def setUp(self): self.application = testpages.TestApplication( model.BaseRoot([ testpages.TPageHTML("one"), [ testpages.TPageHTML("one-one"), testpages.TPageHTML("one-two"), testpages.TPageHTML("one-three"), [ testpages.TPageHTML("one-three-one"), ] ], testpages.TPage("marker"), testpages.TPage("two", internal=True, structural=True), testpages.TPageHTML("three"), testpages.TPageHTML("exclude"), [ testpages.TPageHTML("exclude2"), ], testpages.TPageHTML("nest1"), [ testpages.TPageHTML("nest2"), ] ])) self.pageName = "one" testpages.DummyState.setUp(self)
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): self.application = testpages.TestApplication( model.BaseRoot([ testpages.TPage("one", internal=True, structural=True), [ testpages.TPageHTML("one-one"), ] ])) self.pageName = "one-one" testpages.DummyState.setUp(self)
def test_ambiguoustoplevel(self): r = model.BaseRoot([ testpages.TPage("test", structural=True), testpages.TPage("test", structural=False), ]) tutils.raises(model.ApplicationError, testpages.TestApplication, r)
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.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()