1
from turbozpt import TurboZpt
2
from turbogears import controllers
3
from turbogears import testutil
1
from turbosimpletal import TurboZpt
2
from turbogears import controllers, expose, testutil
7
RENDERED="<html>\n<head>\n<title>%s</title>\n</head>\n<body>\n<div>Hello, %s</div>\n</body>\n</html>\n"
5
RENDERED = u"<html>\n<head>\n<title>%s</title>\n</head>\n<body>\n<div>Hello, %s</div>\n</body>\n</html>"
9
7
def test_template_lookup():
11
template = tc.load_template("turbozpt.tests.simple")
9
template = tc.load_template("turbosimpletal.tests.simple")
15
13
info = dict(title=TITLE, name=NAME)
17
assert str(t).startswith(RENDERED % (TITLE, NAME))
14
s = template.expand(**info)
15
assert s.startswith(RENDERED % (TITLE, NAME))
19
17
class TestRoot(controllers.Root):
18
@expose(html="zpt:turbosimpletal.tests.simple")
20
19
def index(self, name, title="test"):
21
20
return dict(name=name, title=title)
22
index = turbogears.expose(html="zpt:turbozpt.tests.simple")(index)
24
22
def test_real_life_situation():
25
23
cherrypy.root = TestRoot()
28
25
testutil.createRequest("/?name=%s" % NAME)
29
print cherrypy.response.body
30
26
assert cherrypy.response.body[0].startswith(RENDERED % ("test", NAME))