예제 #1
0
    def test_library_include_errors(self):
        # render not included
        self.assertEqual(view.renderIncludes(self.request), '')

        # include unknown
        view.include('test-lib', self.request)
        self.assertEqual(view.renderIncludes(self.request), '')
예제 #2
0
    def test_library_include_recursive(self):
        lib1 = view.library(
            'test-lib1', path='http://memphis.org/style1.css', type='css')

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

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

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

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

        self.assertEqual(
            view.renderIncludes(self.request),
"""<link type="text/css" rel="stylesheet" href="http://memphis.org/style1.css" />
<link type="text/css" rel="stylesheet" href="http://memphis.org/style2.css" />
<link type="text/css" rel="stylesheet" href="http://memphis.org/style3.css" />
<link type="text/css" rel="stylesheet" href="http://memphis.org/style4.css" />""")
예제 #3
0
    def test_library_include(self):
        lib = view.library(
            'test-lib', path='http://memphis.org/style.css', type='css')

        view.include('test-lib', self.request)
        self.assertEqual(
            view.renderIncludes(self.request),
            '<link type="text/css" rel="stylesheet" href="http://memphis.org/style.css" />')
예제 #4
0
    def test_library_include_resource(self):
        view.static('tests2', 'memphis.view.tests:static/dir1')
        self._init_memphis()

        lib = view.library(
            'test-lib', path='style.css', resource='tests2', type='css')

        request = self._makeRequest()

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

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