~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to turbosimpletal/tests/test_zpt.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2008-04-15 06:38:41 UTC
  • mfrom: (154.1.2 less-insane-daemonizing)
  • Revision ID: launchpad@pqm.canonical.com-20080415063841-b1kpsapbmm8oqbk0
[r=jamesh] make daemonization code less silly, fixing bugs #139161 ("Starting loggerhead process may not close its stdin and stdout properly") & #211526 ("Codebrowse log directory has unnecessarily permissive permissions")

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
from turbosimpletal import TurboZpt
2
 
from turbogears import controllers, expose, testutil
3
 
import cherrypy
4
 
 
5
 
RENDERED = u"<html>\n<head>\n<title>%s</title>\n</head>\n<body>\n<div>Hello, %s</div>\n</body>\n</html>"
6
 
 
7
 
def test_template_lookup():
8
 
    tc = TurboZpt()
9
 
    template = tc.load_template("turbosimpletal.tests.simple")
10
 
    assert template
11
 
    TITLE="test"
12
 
    NAME="World"
13
 
    info = dict(title=TITLE, name=NAME)
14
 
    s = template.expand(**info)
15
 
    assert s.startswith(RENDERED % (TITLE, NAME))
16
 
 
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)
21
 
 
22
 
def test_real_life_situation():
23
 
    cherrypy.root = TestRoot()
24
 
    NAME="Dave"
25
 
    testutil.createRequest("/?name=%s" % NAME)
26
 
    assert cherrypy.response.body[0].startswith(RENDERED % ("test", NAME))