Exemplo n.º 1
0
 def setUp(self):
     self.application = testpages.TestApplication(
         model.BaseRoot([
             testpages.TPageHTMLFileTemplate(),
         ]))
     self.pageName = "TPageHTMLFileTemplate"
     testpages.DummyState.setUp(self)
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 def setUp(self):
     self.application = testpages.TestApplication(
         model.BaseRoot([
             testpages.TPageHTMLFileTemplate(),
             [testpages.TPageHTML("nestedpage")],
             testpages.TPageHTMLTemplate(),
         ]))
     self.application.testing = 2
Exemplo n.º 5
0
 def setUp(self):
     self.application = testpages.TestApplication(
         model.BaseRoot([
             CMissingMethodLayout("missing"),
             CLayout("good"),
             FLayout("flayout"),
         ]))
     self.application.testing = 2
Exemplo n.º 6
0
 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)
Exemplo n.º 7
0
 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)
Exemplo n.º 8
0
 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)
Exemplo n.º 9
0
 def setUp(self):
     self.application = testpages.TestApplication(
         model.BaseRoot([
             CSiblingNavBarPage("top"),
             [
                 CSiblingNavBarPage("one"),
                 [
                     CSiblingNavBarPage("onechild"),
                 ],
                 CSiblingNavBarPage("two"),
                 CSiblingNavBarPage("three"),
                 CNonstructuralPage("nonstruct")
             ],
             CNavBarPage("fixedmenu")
         ]))
Exemplo n.º 10
0
    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"
Exemplo n.º 11
0
 def setUp(self):
     self.application = testpages.TestApplication(
         model.BaseRoot([
             FLayout("flayout"),
         ]))
     self.application.testing = 2
Exemplo n.º 12
0
        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()
        self.application.pre(p)