Changeset 2264

Show
Ignore:
Timestamp:
12/22/06 12:33:10 (2 years ago)
Author:
alberto
Message:

Merging 2262:2263 from 1.0

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/turbogears/qstemplates/quickstart/+package+/tests/test_controllers.py_tmpl

    r611 r2264  
    1414    "The mainpage should have the right title" 
    1515    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  
    1616from cherrypy import _cphttptools 
    1717 
    18 from turbogears import database, controllers, startup, validators, config 
     18from turbogears import database, controllers, startup, validators, config, update_config 
    1919from turbogears.util import get_model 
     20 
     21import os 
     22from os.path import * 
     23 
     24if 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) 
     33else: 
     34    database.set_db_uri("sqlite:///:memory:") 
    2035 
    2136config.update({"global" : {"tg.new_style_logging" : True}}) 
    2237config.update({"global" : {"autoreload.on" : False}}) 
    23 cherrypy.server.start(serverClass=None, initOnly=True) 
    24 database.set_db_uri("sqlite:///:memory:") 
     38 
     39def start_cp(): 
     40    if not config.get("cherrypy_started", False): 
     41        cherrypy.server.start(serverClass=None, initOnly=True) 
     42        config.update({"cherrypy_started" : True}) 
    2543 
    2644def create_request(request, method="GET", protocol="HTTP/1.1", 
    2745    headers={}, rfile=None, clientAddress="127.0.0.1", 
    2846    remoteHost="localhost", scheme="http"): 
     47    start_cp() 
    2948    if not rfile: 
    3049        rfile = StringIO.StringIO("") 
     
    7594 
    7695def call(method, *args, **kw): 
     96    start_cp() 
    7797    output, response = call_with_request(method, DummyRequest(), *args, **kw) 
    7898    return output