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