Package turbogears :: Module testutil

Module testutil

source code

TurboGears Test Utilities.

Classes
  TGTest
A WebTest enabled unit testing class.
  BrowsingSession
  DummySession
A very simple dummy session.
  DBTestSO
  DBTestSA
  DBTest
Functions
 
unmount()
Remove an application from the object traversal tree.
source code
 
mount(controller, path='/')
Mount a controller at a path.
source code
 
make_wsgiapp()
Return a WSGI application from CherryPy.
source code
 
make_app(controller=None)
Return a WebTest.TestApp instance from CherryPy.
source code
 
start_server(tg_only=True)
Start the server if it's not already started.
source code
 
stop_server(tg_only=False)
Stop the server and unmount the application.
source code
 
capture_log(category)
Capture log for one category.
source code
 
print_log()
Print the log captured by capture_log to stdout.
source code
 
get_log()
Return the list of log messages captured by capture_log.
source code
 
sqlalchemy_cleanup() source code
Function Details

mount(controller, path='/')

source code 

Mount a controller at a path. Returns a WSGI application.

make_app(controller=None)

source code 

Return a WebTest.TestApp instance from CherryPy.

If a Controller object is provided, it will be mounted at the root level. If not, it'll look for an already mounted root.

start_server(tg_only=True)

source code 

Start the server if it's not already started.

Use tg_only=False to run the CherryPy engine as well.

stop_server(tg_only=False)

source code 

Stop the server and unmount the application.

Use tg_only=True to leave CherryPy running (for faster tests).

capture_log(category)

source code 

Capture log for one category.

The category can either be a single category (a string like 'foo.bar') or a list of them. You *must* call print_log() to reset when you're done.

print_log()

source code 

Print the log captured by capture_log to stdout.

Resets that log and resets the temporarily added handlers.

get_log()

source code 

Return the list of log messages captured by capture_log.

Resets that log and resets the temporarily added handlers.