Back to index

python3.2  3.2.2
Classes | Public Member Functions | Public Attributes
test.test_httpservers.BaseHTTPServerTestCase Class Reference
Inheritance diagram for test.test_httpservers.BaseHTTPServerTestCase:
Inheritance graph
[legend]
Collaboration diagram for test.test_httpservers.BaseHTTPServerTestCase:
Collaboration graph
[legend]

List of all members.

Classes

class  request_handler

Public Member Functions

def setUp
def test_command
def test_request_line_trimming
def test_version_bogus
def test_version_digits
def test_version_none_get
def test_version_none
def test_version_invalid
def test_send_blank
def test_header_close
def test_head_keep_alive
def test_handler
def test_return_header_keep_alive
def test_internal_key_error
def test_return_custom_status
def test_latin1_header
def tearDown
def request

Public Attributes

 con
 server_started
 thread
 connection

Detailed Description

Definition at line 74 of file test_httpservers.py.


Member Function Documentation

def test.test_httpservers.BaseTestCase.request (   self,
  uri,
  method = 'GET',
  body = None,
  headers = {} 
) [inherited]

Definition at line 68 of file test_httpservers.py.

00068 
00069     def request(self, uri, method='GET', body=None, headers={}):
00070         self.connection = http.client.HTTPConnection(self.HOST, self.PORT)
00071         self.connection.request(method, uri, body, headers)
00072         return self.connection.getresponse()
00073 

Here is the caller graph for this function:

Reimplemented from test.test_httpservers.BaseTestCase.

Definition at line 108 of file test_httpservers.py.

00108 
00109     def setUp(self):
00110         BaseTestCase.setUp(self)
00111         self.con = http.client.HTTPConnection(self.HOST, self.PORT)
00112         self.con.connect()

Here is the caller graph for this function:

def test.test_httpservers.BaseTestCase.tearDown (   self) [inherited]

Reimplemented in test.test_httpservers.CGIHTTPServerTestCase, and test.test_httpservers.SimpleHTTPServerTestCase.

Definition at line 63 of file test_httpservers.py.

00063 
00064     def tearDown(self):
00065         self.thread.stop()
00066         os.environ.__exit__()
00067         support.threading_cleanup(*self._threads)

Here is the caller graph for this function:

Definition at line 113 of file test_httpservers.py.

00113 
00114     def test_command(self):
00115         self.con.request('GET', '/')
00116         res = self.con.getresponse()
00117         self.assertEqual(res.status, 501)

Here is the call graph for this function:

Definition at line 183 of file test_httpservers.py.

00183 
00184     def test_handler(self):
00185         self.con.request('TEST', '/')
00186         res = self.con.getresponse()
00187         self.assertEqual(res.status, 204)

Here is the call graph for this function:

Definition at line 175 of file test_httpservers.py.

00175 
00176     def test_head_keep_alive(self):
00177         self.con._http_vsn_str = 'HTTP/1.1'
00178         self.con.putrequest('GET', '/')
00179         self.con.putheader('Connection', 'keep-alive')
00180         self.con.endheaders()
00181         res = self.con.getresponse()
00182         self.assertEqual(res.status, 501)

Here is the call graph for this function:

Definition at line 168 of file test_httpservers.py.

00168 
00169     def test_header_close(self):
00170         self.con.putrequest('GET', '/')
00171         self.con.putheader('Connection', 'close')
00172         self.con.endheaders()
00173         res = self.con.getresponse()
00174         self.assertEqual(res.status, 501)

Here is the call graph for this function:

Definition at line 195 of file test_httpservers.py.

00195 
00196     def test_internal_key_error(self):
00197         self.con.request('KEYERROR', '/')
00198         res = self.con.getresponse()
00199         self.assertEqual(res.status, 999)

Here is the call graph for this function:

Definition at line 205 of file test_httpservers.py.

00205 
00206     def test_latin1_header(self):
00207         self.con.request('LATINONEHEADER', '/', headers={
00208             'X-Special-Incoming':       'Ärger mit Unicode'
00209         })
00210         res = self.con.getresponse()
00211         self.assertEqual(res.getheader('X-Special'), 'Dängerous Mind')
00212         self.assertEqual(res.read(), 'Ärger mit Unicode'.encode('utf-8'))
00213 

Here is the call graph for this function:

Definition at line 118 of file test_httpservers.py.

00118 
00119     def test_request_line_trimming(self):
00120         self.con._http_vsn_str = 'HTTP/1.1\n'
00121         self.con.putrequest('GET', '/')
00122         self.con.endheaders()
00123         res = self.con.getresponse()
00124         self.assertEqual(res.status, 501)

Here is the call graph for this function:

Definition at line 200 of file test_httpservers.py.

00200 
00201     def test_return_custom_status(self):
00202         self.con.request('CUSTOM', '/')
00203         res = self.con.getresponse()
00204         self.assertEqual(res.status, 999)

Here is the call graph for this function:

Definition at line 188 of file test_httpservers.py.

00188 
00189     def test_return_header_keep_alive(self):
00190         self.con.request('KEEP', '/')
00191         res = self.con.getresponse()
00192         self.assertEqual(res.getheader('Connection'), 'keep-alive')
00193         self.con.request('TEST', '/')
00194         self.addCleanup(self.con.close)

Here is the call graph for this function:

Definition at line 161 of file test_httpservers.py.

00161 
00162     def test_send_blank(self):
00163         self.con._http_vsn_str = ''
00164         self.con.putrequest('', '')
00165         self.con.endheaders()
00166         res = self.con.getresponse()
00167         self.assertEqual(res.status, 400)

Here is the call graph for this function:

Definition at line 125 of file test_httpservers.py.

00125 
00126     def test_version_bogus(self):
00127         self.con._http_vsn_str = 'FUBAR'
00128         self.con.putrequest('GET', '/')
00129         self.con.endheaders()
00130         res = self.con.getresponse()
00131         self.assertEqual(res.status, 400)

Here is the call graph for this function:

Definition at line 132 of file test_httpservers.py.

00132 
00133     def test_version_digits(self):
00134         self.con._http_vsn_str = 'HTTP/9.9.9'
00135         self.con.putrequest('GET', '/')
00136         self.con.endheaders()
00137         res = self.con.getresponse()
00138         self.assertEqual(res.status, 400)

Here is the call graph for this function:

Definition at line 153 of file test_httpservers.py.

00153 
00154     def test_version_invalid(self):
00155         self.con._http_vsn = 99
00156         self.con._http_vsn_str = 'HTTP/9.9'
00157         self.con.putrequest('GET', '/')
00158         self.con.endheaders()
00159         res = self.con.getresponse()
00160         self.assertEqual(res.status, 505)

Here is the call graph for this function:

Definition at line 146 of file test_httpservers.py.

00146 
00147     def test_version_none(self):
00148         self.con._http_vsn_str = ''
00149         self.con.putrequest('PUT', '/')
00150         self.con.endheaders()
00151         res = self.con.getresponse()
00152         self.assertEqual(res.status, 400)

Here is the call graph for this function:

Definition at line 139 of file test_httpservers.py.

00139 
00140     def test_version_none_get(self):
00141         self.con._http_vsn_str = ''
00142         self.con.putrequest('GET', '/')
00143         self.con.endheaders()
00144         res = self.con.getresponse()
00145         self.assertEqual(res.status, 501)

Here is the call graph for this function:


Member Data Documentation

Definition at line 110 of file test_httpservers.py.

Definition at line 69 of file test_httpservers.py.

Definition at line 58 of file test_httpservers.py.

Definition at line 59 of file test_httpservers.py.


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