Пример #1
0
    def test_as_urlpatterns(self, page, patterns):
        """
        as_urlpatterns should return a urlconf with the pages for all the nodes
        included in the tree.
        """
        child1 = PageNode('child1', path='asdf/qwer', template='fake.html')
        child2 = PageNode('child2', path='bb/qr', template='fake2.html')
        parent = PageNode('parent', children=[child1, child2])
        root = PageRoot('root',
                        path='badsbi',
                        template='fake3.html',
                        children=[parent])

        patterns.return_value = 'asdf'
        # Mocking properties
        page.__get__ = lambda mock, self, cls: self.display_name

        eq_(root.as_urlpatterns(), 'asdf')

        args = patterns.call_args[0]
        eq_(args[0], '')
        ok_('child1' in args)
        ok_('child2' in args)
        ok_('root' in args)
        ok_('parent' not in args)
Пример #2
0
    def test_as_urlpatterns(self, page):
        """
        as_urlpatterns should return a urlconf with the pages for all the nodes
        included in the tree.
        """
        child1 = PageNode('child1', path='asdf/qwer', template='fake.html')
        child2 = PageNode('child2', path='bb/qr', template='fake2.html')
        parent = PageNode('parent', children=[child1, child2])
        root = PageRoot('root',
                        path='badsbi',
                        template='fake3.html',
                        children=[parent])

        # Mocking properties
        page.__get__ = lambda mock, self, cls: self.display_name

        assert root.as_urlpatterns() == ['root', 'child1', 'child2']
Пример #3
0
    def test_as_urlpatterns(self, page):
        """
        as_urlpatterns should return a urlconf with the pages for all the nodes
        included in the tree.
        """
        child1 = PageNode("child1", path="asdf/qwer", template="fake.html")
        child2 = PageNode("child2", path="bb/qr", template="fake2.html")
        parent = PageNode("parent", children=[child1, child2])
        root = PageRoot("root",
                        path="badsbi",
                        template="fake3.html",
                        children=[parent])

        # Mocking properties
        page.__get__ = lambda mock, self, cls: self.display_name

        assert root.as_urlpatterns() == ["root", "child1", "child2"]
Пример #4
0
    def test_as_urlpatterns(self, page):
        """
        as_urlpatterns should return a urlconf with the pages for all the nodes
        included in the tree.
        """
        child1 = PageNode('child1', path='asdf/qwer', template='fake.html')
        child2 = PageNode('child2', path='bb/qr', template='fake2.html')
        parent = PageNode('parent', children=[child1, child2])
        root = PageRoot('root', path='badsbi', template='fake3.html',
                        children=[parent])

        # Mocking properties
        page.__get__ = lambda mock, self, cls: self.display_name

        args = root.as_urlpatterns()

        assert 'child1' in args
        assert 'child2' in args
        assert 'root' in args
        assert 'parent' not in args
Пример #5
0
    def test_as_urlpatterns(self, page, patterns):
        """
        as_urlpatterns should return a urlconf with the pages for all the nodes
        included in the tree.
        """
        child1 = PageNode('child1', path='asdf/qwer', template='fake.html')
        child2 = PageNode('child2', path='bb/qr', template='fake2.html')
        parent = PageNode('parent', children=[child1, child2])
        root = PageRoot('root', path='badsbi', template='fake3.html',
                        children=[parent])

        patterns.return_value = 'asdf'
        # Mocking properties
        page.__get__ = lambda mock, self, cls: self.display_name

        eq_(root.as_urlpatterns(), 'asdf')

        args = patterns.call_args[0]
        eq_(args[0], '')
        ok_('child1' in args)
        ok_('child2' in args)
        ok_('root' in args)
        ok_('parent' not in args)