Changeset 2264
- Timestamp:
- 12/22/06 12:33:10 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/turbogears/qstemplates/quickstart/+package+/tests/test_controllers.py_tmpl
r611 r2264 14 14 "The mainpage should have the right title" 15 15 testutil.createRequest("/") 16 assert "< TITLE>Welcome to TurboGears</TITLE>" in cherrypy.response.body[0]16 assert "<title>Welcome to TurboGears</title>" in cherrypy.response.body[0] trunk/turbogears/testutil.py
r2246 r2264 16 16 from cherrypy import _cphttptools 17 17 18 from turbogears import database, controllers, startup, validators, config 18 from turbogears import database, controllers, startup, validators, config, update_config 19 19 from turbogears.util import get_model 20 21 import os 22 from os.path import * 23 24 if exists(join(os.getcwd(), "test.cfg")): 25 modulename = None 26 for f in os.walk(os.getcwd()): 27 if f[0].endswith("config"): 28 config_dir = f[0].replace(os.getcwd(), "")[1:] 29 modulename = "%s.app" % config_dir.replace(os.sep, ".") 30 break 31 update_config(configfile=join(os.getcwd(), "test.cfg"), 32 modulename=modulename) 33 else: 34 database.set_db_uri("sqlite:///:memory:") 20 35 21 36 config.update({"global" : {"tg.new_style_logging" : True}}) 22 37 config.update({"global" : {"autoreload.on" : False}}) 23 cherrypy.server.start(serverClass=None, initOnly=True) 24 database.set_db_uri("sqlite:///:memory:") 38 39 def start_cp(): 40 if not config.get("cherrypy_started", False): 41 cherrypy.server.start(serverClass=None, initOnly=True) 42 config.update({"cherrypy_started" : True}) 25 43 26 44 def create_request(request, method="GET", protocol="HTTP/1.1", 27 45 headers={}, rfile=None, clientAddress="127.0.0.1", 28 46 remoteHost="localhost", scheme="http"): 47 start_cp() 29 48 if not rfile: 30 49 rfile = StringIO.StringIO("") … … 75 94 76 95 def call(method, *args, **kw): 96 start_cp() 77 97 output, response = call_with_request(method, DummyRequest(), *args, **kw) 78 98 return output