Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes
test.test_urllib2.MockHTTPHandler Class Reference
Inheritance diagram for test.test_urllib2.MockHTTPHandler:
Inheritance graph
[legend]
Collaboration diagram for test.test_urllib2.MockHTTPHandler:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def reset
def http_open
def add_parent
def close
def __lt__

Public Attributes

 code
 headers
 requests
 req
 parent

Static Public Attributes

int handler_order = 500

Private Attributes

 _count

Detailed Description

Definition at line 404 of file test_urllib2.py.


Constructor & Destructor Documentation

def test.test_urllib2.MockHTTPHandler.__init__ (   self,
  code,
  headers 
)

Definition at line 408 of file test_urllib2.py.

00408 
00409     def __init__(self, code, headers):
00410         self.code = code
00411         self.headers = headers
        self.reset()

Here is the caller graph for this function:


Member Function Documentation

def urllib.request.BaseHandler.__lt__ (   self,
  other 
) [inherited]

Definition at line 467 of file request.py.

00467 
00468     def __lt__(self, other):
00469         if not hasattr(other, "handler_order"):
00470             # Try to preserve the old behavior of having custom classes
00471             # inserted after default ones (works only for custom user
00472             # classes which are not aware of handler_order).
00473             return True
00474         return self.handler_order < other.handler_order
00475 

def urllib.request.BaseHandler.add_parent (   self,
  parent 
) [inherited]

Definition at line 460 of file request.py.

00460 
00461     def add_parent(self, parent):
00462         self.parent = parent

def urllib.request.BaseHandler.close (   self) [inherited]

Definition at line 463 of file request.py.

00463 
00464     def close(self):
00465         # Only exists for backwards compatibility
00466         pass

Here is the caller graph for this function:

Definition at line 415 of file test_urllib2.py.

00415 
00416     def http_open(self, req):
00417         import email, http.client, copy
00418         from io import StringIO
00419         self.requests.append(copy.deepcopy(req))
00420         if self._count == 0:
00421             self._count = self._count + 1
00422             name = http.client.responses[self.code]
00423             msg = email.message_from_string(self.headers)
00424             return self.parent.error(
00425                 "http", req, MockFile(), self.code, name, msg)
00426         else:
00427             self.req = req
00428             msg = email.message_from_string("\r\n\r\n")
00429             return MockResponse(200, "OK", msg, "", req.get_full_url())

Here is the call graph for this function:

Definition at line 412 of file test_urllib2.py.

00412 
00413     def reset(self):
00414         self._count = 0
        self.requests = []

Here is the caller graph for this function:


Member Data Documentation

Definition at line 413 of file test_urllib2.py.

Definition at line 409 of file test_urllib2.py.

int urllib.request.BaseHandler.handler_order = 500 [static, inherited]

Definition at line 410 of file test_urllib2.py.

Definition at line 461 of file request.py.

Definition at line 426 of file test_urllib2.py.

Definition at line 414 of file test_urllib2.py.


The documentation for this class was generated from the following file: