~jonas-drange/ubuntu-start-page/1252899-mobile-friendly

« back to all changes in this revision

Viewing changes to src/Mako-0.1.9/test/tgplugin.py

  • Committer: Matthew Nuzum
  • Date: 2008-04-18 01:58:53 UTC
  • Revision ID: matthew.nuzum@canonical.com-20080418015853-2b8rf979z2c2exxl
adding files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import unittest
 
2
 
 
3
from mako.ext.turbogears import TGPlugin
 
4
from util import flatten_result, result_lines
 
5
 
 
6
tl = TGPlugin(options=dict(directories=['./test_htdocs']), extension='html')
 
7
 
 
8
class TestTGPlugun(unittest.TestCase):
 
9
    def test_basic(self):
 
10
        t = tl.load_template('/index.html')
 
11
        assert result_lines(t.render()) == [
 
12
            "this is index"
 
13
        ]
 
14
    def test_subdir(self):
 
15
        t = tl.load_template('/subdir/index.html')
 
16
        assert result_lines(t.render()) == [
 
17
            "this is sub index",
 
18
            "this is include 2"
 
19
 
 
20
        ]
 
21
 
 
22
        assert tl.load_template('/subdir/index.html').module_id == '_subdir_index_html'
 
23
 
 
24
    def test_basic_dot(self):
 
25
        t = tl.load_template('index')
 
26
        assert result_lines(t.render()) == [
 
27
            "this is index"
 
28
        ]
 
29
    def test_subdir_dot(self):
 
30
        t = tl.load_template('subdir.index')
 
31
        assert result_lines(t.render()) == [
 
32
            "this is sub index",
 
33
            "this is include 2"
 
34
 
 
35
        ]
 
36
 
 
37
        assert tl.load_template('subdir.index').module_id == '_subdir_index_html'
 
38
    
 
39
    def test_string(self):
 
40
        t = tl.load_template('foo', "hello world")
 
41
        assert t.render() == "hello world"
 
42
        
 
43
if __name__ == '__main__':
 
44
    unittest.main()
 
 
b'\\ No newline at end of file'