Ejemplo n.º 1
0
    def test_library_include_errors(self):
        # render not included
        self.assertEqual(view.render_includes(self.request), '')

        # include unknown
        view.include(self.request, 'test-lib-test')
        self.assertEqual(view.render_includes(self.request), '')
Ejemplo n.º 2
0
    def test_library_include_recursive(self):
        view.library(
            'test-lib1', path='http://ptah.org/style1.css', type='css')

        view.library(
            'test-lib2', path='http://ptah.org/style2.css', type='css',
            require='test-lib1')

        view.library(
            'test-lib3', path='http://ptah.org/style3.css', type='css',
            require=('test-lib1', 'test-lib2'))

        view.library(
            'test-lib4', path='http://ptah.org/style4.css', type='css',
            require=('test-lib1', 'test-lib2'))
        self._init_ptah()

        view.include(self.request, 'test-lib3')
        view.include(self.request, 'test-lib4')

        self.assertEqual(
            view.render_includes(self.request),
"""<link type="text/css" rel="stylesheet" href="http://ptah.org/style1.css" />
<link type="text/css" rel="stylesheet" href="http://ptah.org/style2.css" />
<link type="text/css" rel="stylesheet" href="http://ptah.org/style3.css" />
<link type="text/css" rel="stylesheet" href="http://ptah.org/style4.css" />""")
Ejemplo n.º 3
0
    def test_library_include(self):
        view.library(
            'test-lib', path='http://ptah.org/style.css', type='css')
        self._init_ptah()

        view.include(self.request, 'test-lib')
        self.assertEqual(
            view.render_includes(self.request),
            '<link type="text/css" rel="stylesheet" href="http://ptah.org/style.css" />')
Ejemplo n.º 4
0
    def test_library_include_resource(self):
        view.static('tests2', 'ptah.view.tests:static/dir1')
        view.library(
            'test-lib', path='style.css', resource='tests2', type='css')
        self._init_ptah()

        request = self._makeRequest()

        view.include(request, 'test-lib')

        self.assertEqual(
            view.render_includes(request),
            '<link type="text/css" rel="stylesheet" href="http://localhost:8080/static/tests2/style.css" />')