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