Exemple #1
0
 def test_in_navigation(self):
     from kotti.views.slots import render_local_navigation
     a, aa, ab, ac, aca, acb = create_contents()
     
     assert render_local_navigation(a, DummyRequest()) is not None
     aa.in_navigation = False
     ab.in_navigation = False
     ac.in_navigation = False
     assert render_local_navigation(a, DummyRequest()) is None
Exemple #2
0
    def test_no_permission(self, has_permission):
        from kotti.views.slots import render_local_navigation
        a, aa, ab, ac, aca, acb = create_contents()

        has_permission.return_value = True
        assert render_local_navigation(ac, DummyRequest()) is not None

        has_permission.return_value = False
        assert render_local_navigation(ac, DummyRequest()) is None
Exemple #3
0
    def test_in_navigation(self):
        from kotti.views.slots import render_local_navigation
        a, aa, ab, ac, aca, acb = create_contents()

        assert render_local_navigation(a, DummyRequest()) is not None
        aa.in_navigation = False
        ab.in_navigation = False
        ac.in_navigation = False
        assert render_local_navigation(a, DummyRequest()) is None
Exemple #4
0
    def test_no_permission(self, has_permission):
        from kotti.views.slots import render_local_navigation
        a, aa, ab, ac, aca, acb = create_contents()

        has_permission.return_value = True
        assert render_local_navigation(ac, DummyRequest()) is not None

        has_permission.return_value = False
        assert render_local_navigation(ac, DummyRequest()) is None
Exemple #5
0
 def test_slots_render_local_navigation(self):
     from kotti.views.slots import render_local_navigation
     root = DBSession().query(Node).get(1)
     request = DummyRequest()
     a, aa, ab, ac, aca, acb = self._create_contents(root)
     self.assertEqual(render_local_navigation(root, request), None)
     self.assertNotEqual(render_local_navigation(a, request), None)
     self.assertEqual("ab" in render_local_navigation(a, request), True)
     ab.in_navigation = False
     self.assertEqual("ab" in render_local_navigation(a, request), False)
Exemple #6
0
    def test_it(self):
        from kotti.views.slots import render_local_navigation
        a, aa, ab, ac, aca, acb = create_contents()

        assert render_local_navigation(ac, DummyRequest()) is not None
        self.renderer.assert_(parent=ac, children=[aca, acb])

        assert render_local_navigation(acb, DummyRequest()) is not None
        self.renderer.assert_(parent=ac, children=[aca, acb])

        assert render_local_navigation(a.__parent__, DummyRequest()) is None
Exemple #7
0
    def test_it(self):
        from kotti.views.slots import render_local_navigation
        a, aa, ab, ac, aca, acb = create_contents()

        assert render_local_navigation(ac, DummyRequest()) is not None
        self.renderer.assert_(parent=ac, children=[aca, acb])

        assert render_local_navigation(acb, DummyRequest()) is not None
        self.renderer.assert_(parent=ac, children=[aca, acb])

        assert render_local_navigation(a.__parent__, DummyRequest()) is None