~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to turbosimpletal/tests/test_zpt.py

some kind of progress

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
import turbogears
5
5
import cherrypy
6
6
 
7
 
RENDERED="<html>\n<head>\n<title>%s</title>\n</head>\n<body>\n<div>Hello, %s</div>\n</body>\n</html>\n"
 
7
RENDERED="<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<html>\n<head>\n<title>%s</title>\n</head>\n<body>\n<div>Hello, %s</div>\n</body>\n</html>"
8
8
 
9
9
def test_template_lookup():
10
10
    tc = TurboZpt()
13
13
    TITLE="test"
14
14
    NAME="World"
15
15
    info = dict(title=TITLE, name=NAME)
16
 
    t = template(**info)
17
 
    assert str(t).startswith(RENDERED % (TITLE, NAME))
 
16
    import StringIO
 
17
    s = StringIO.StringIO()
 
18
    from simpletal import simpleTALES
 
19
    context = simpleTALES.Context(allowPythonPath=1)
 
20
    for k, v in info.iteritems():
 
21
        context.addGlobal(k, v)
 
22
    template.expand(context, s)#(**info)
 
23
    print s.getvalue()
 
24
    print RENDERED % (TITLE, NAME)
 
25
    assert s.getvalue().startswith(RENDERED % (TITLE, NAME))
18
26
 
19
27
class TestRoot(controllers.Root):
20
28
    def index(self, name, title="test"):