Package turbogears :: Module testutil :: Class TGTest

Class TGTest

source code

       object --+    
                |    
unittest.TestCase --+
                    |
                   TGTest

A WebTest enabled unit testing class.

To use, subclass & set root to your controller object, or set app to a webtest.TestApp instance.

In your tests, use self.app to make WebTest calls.

Nested Classes

Inherited from unittest.TestCase: failureException

Instance Methods
 
setUp(self)
Set up the WebTest by starting the server.
source code
 
tearDown(self)
Tear down the WebTest by stopping the server.
source code
 
login_user(self, user)
Log a specified user object into the system.
source code

Inherited from unittest.TestCase: __call__, __eq__, __hash__, __init__, __ne__, __repr__, __str__, assertAlmostEqual, assertAlmostEquals, assertEqual, assertEquals, assertFalse, assertNotAlmostEqual, assertNotAlmostEquals, assertNotEqual, assertNotEquals, assertRaises, assertTrue, assert_, countTestCases, debug, defaultTestResult, fail, failIf, failIfAlmostEqual, failIfEqual, failUnless, failUnlessAlmostEqual, failUnlessEqual, failUnlessRaises, id, run, shortDescription

Inherited from object: __delattr__, __format__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Variables
  root = None
hash(x)
  app = None
hash(x)
  stop_tg_only = False
  config = None
hash(x)
Properties

Inherited from object: __class__

Method Details

setUp(self)

source code 

Set up the WebTest by starting the server.

You should override this and make sure you have properly mounted a root for your server before calling super, or simply pass a root controller to super. Otherwise the CherryPy filters for TurboGears will not be used.

Overrides: unittest.TestCase.setUp

tearDown(self)

source code 

Tear down the WebTest by stopping the server.

Overrides: unittest.TestCase.tearDown