Package turbogears :: Module testutil :: Class TGTest

Class TGTest

source code

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

A WebTest enabled unit testing class.

To use, subclass and 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.case.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.case.TestCase: __call__, __eq__, __hash__, __init__, __ne__, __repr__, __str__, addCleanup, addTypeEqualityFunc, assertAlmostEqual, assertAlmostEquals, assertDictContainsSubset, assertDictEqual, assertEqual, assertEquals, assertFalse, assertGreater, assertGreaterEqual, assertIn, assertIs, assertIsInstance, assertIsNone, assertIsNot, assertIsNotNone, assertItemsEqual, assertLess, assertLessEqual, assertListEqual, assertMultiLineEqual, assertNotAlmostEqual, assertNotAlmostEquals, assertNotEqual, assertNotEquals, assertNotIn, assertNotIsInstance, assertNotRegexpMatches, assertRaises, assertRaisesRegexp, assertRegexpMatches, assertSequenceEqual, assertSetEqual, assertTrue, assertTupleEqual, assert_, countTestCases, debug, defaultTestResult, doCleanups, fail, failIf, failIfAlmostEqual, failIfEqual, failUnless, failUnlessAlmostEqual, failUnlessEqual, failUnlessRaises, id, run, shortDescription, skipTest

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

Class Methods

Inherited from unittest.case.TestCase: setUpClass, tearDownClass

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

Inherited from unittest.case.TestCase: longMessage, maxDiff

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 hooks for TurboGears will not be used.

Overrides: unittest.case.TestCase.setUp

tearDown(self)

source code 

Tear down the WebTest by stopping the server.

Overrides: unittest.case.TestCase.tearDown