Package cherrypy :: Package test :: Module webtest :: Class WebCase
[hide private]
[frames] | no frames]

Class WebCase

source code

            object --+    
                     |    
unittest.case.TestCase --+
                         |
                        WebCase
Known Subclasses:

Nested Classes [hide private]
  HTTP_CONN

Inherited from unittest.case.TestCase: failureException

Instance Methods [hide private]
 
get_conn(self, auto_open=False)
Return a connection to our HTTP server.
source code
 
set_persistent(self, on=True, auto_open=False)
Make our HTTP_CONN persistent (or not).
source code
 
_get_persistent(self) source code
 
_set_persistent(self, on) source code
 
interface(self)
Return an IP address for a client connection.
source code
 
getPage(self, url, headers=None, method='GET', body=None, protocol=None)
Open the url with debugging support.
source code
 
_handlewebError(self, msg) source code
 
exit(self) source code
 
assertStatus(self, status, msg=None)
Fail if self.status != status.
source code
 
assertHeader(self, key, value=None, msg=None)
Fail if (key, [value]) not in self.headers.
source code
 
assertHeaderItemValue(self, key, value, msg=None)
Fail if the header does not contain the specified value
source code
 
assertNoHeader(self, key, msg=None)
Fail if key in self.headers.
source code
 
assertBody(self, value, msg=None)
Fail if value != self.body.
source code
 
assertInBody(self, value, msg=None)
Fail if value not in self.body.
source code
 
assertNotInBody(self, value, msg=None)
Fail if value in self.body.
source code
 
assertMatchesBody(self, pattern, msg=None, flags=0)
Fail if value (a regex pattern) is not in self.body.
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, setUp, shortDescription, skipTest, tearDown

Inherited from unittest.case.TestCase (private): _addSkip, _baseAssertEqual, _deprecate, _formatMessage, _getAssertEqualityFunc, _truncateMessage

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

Class Methods [hide private]

Inherited from unittest.case.TestCase: setUpClass, tearDownClass

Class Variables [hide private]
  HOST = '127.0.0.1'
  PORT = 8000
  PROTOCOL = 'HTTP/1.1'
  scheme = 'http'
  url = None
hash(x)
  status = None
hash(x)
  headers = None
hash(x)
  body = None
hash(x)
  encoding = 'utf-8'
  time = None
hash(x)
  interactive = True
  console_height = 30

Inherited from unittest.case.TestCase: longMessage, maxDiff

Inherited from unittest.case.TestCase (private): _classSetupFailed, _diffThreshold

Properties [hide private]
  persistent

Inherited from object: __class__

Method Details [hide private]

set_persistent(self, on=True, auto_open=False)

source code 

Make our HTTP_CONN persistent (or not).

If the 'on' argument is True (the default), then self.HTTP_CONN will be set to an instance of HTTPConnection (or HTTPS if self.scheme is "https"). This will then persist across requests.

We only allow for a single open connection, so if you call this and we currently have an open connection, it will be closed.

interface(self)

source code 

Return an IP address for a client connection.

If the server is listening on '0.0.0.0' (INADDR_ANY) or '::' (IN6ADDR_ANY), this will return the proper localhost.

getPage(self, url, headers=None, method='GET', body=None, protocol=None)

source code 

Open the url with debugging support. Return status, headers, body.


Property Details [hide private]

persistent

Get Method:
_get_persistent(self)
Set Method:
_set_persistent(self, on)