Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Attributes
test.test_docxmlrpc.DocXMLRPCHTTPGETServer Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def test_valid_get_response
def test_invalid_get_response
def test_lambda
def test_autolinking
def test_system_methods
def test_autolink_dotted_methods

Public Attributes

 evt
 client

Private Attributes

 _threads

Detailed Description

Definition at line 70 of file test_docxmlrpc.py.


Member Function Documentation

Definition at line 71 of file test_docxmlrpc.py.

00071 
00072     def setUp(self):
00073         self._threads = support.threading_setup()
00074         # Enable server feedback
00075         DocXMLRPCServer._send_traceback_header = True
00076 
00077         self.evt = threading.Event()
00078         threading.Thread(target=server, args=(self.evt, 1)).start()
00079 
00080         # wait for port to be assigned
00081         n = 1000
00082         while n > 0 and PORT is None:
00083             time.sleep(0.001)
00084             n -= 1
00085 
00086         self.client = http.client.HTTPConnection("localhost:%d" % PORT)

Here is the caller graph for this function:

Definition at line 87 of file test_docxmlrpc.py.

00087 
00088     def tearDown(self):
00089         self.client.close()
00090 
00091         self.evt.wait()
00092 
00093         # Disable server feedback
00094         DocXMLRPCServer._send_traceback_header = False
00095         support.threading_cleanup(*self._threads)

Here is the caller graph for this function:

Test that selfdot values are made strong automatically in the
documentation.

Definition at line 185 of file test_docxmlrpc.py.

00185 
00186     def test_autolink_dotted_methods(self):
00187         """Test that selfdot values are made strong automatically in the
00188         documentation."""
00189         self.client.request("GET", "/")
00190         response = self.client.getresponse()
00191 
00192         self.assertIn(b"""Try&nbsp;self.<strong>add</strong>,&nbsp;too.""",
00193                       response.read())

Here is the call graph for this function:

Test that the server correctly automatically wraps references to
PEPS and RFCs with links, and that it linkifies text starting with
http or ftp protocol prefixes.

The documentation for the "add" method contains the test material.

Definition at line 131 of file test_docxmlrpc.py.

00131 
00132     def test_autolinking(self):
00133         """Test that the server correctly automatically wraps references to
00134         PEPS and RFCs with links, and that it linkifies text starting with
00135         http or ftp protocol prefixes.
00136 
00137         The documentation for the "add" method contains the test material.
00138         """
00139         self.client.request("GET", "/")
00140         response = self.client.getresponse().read()
00141 
00142         self.assertIn(
00143             (b'<dl><dt><a name="-add"><strong>add</strong></a>(x, y)</dt><dd>'
00144              b'<tt>Add&nbsp;two&nbsp;instances&nbsp;together.&nbsp;This&nbsp;'
00145              b'follows&nbsp;<a href="http://www.python.org/dev/peps/pep-0008/">'
00146              b'PEP008</a>,&nbsp;but&nbsp;has&nbsp;nothing<br>\nto&nbsp;do&nbsp;'
00147              b'with&nbsp;<a href="http://www.rfc-editor.org/rfc/rfc1952.txt">'
00148              b'RFC1952</a>.&nbsp;Case&nbsp;should&nbsp;matter:&nbsp;pEp008&nbsp;'
00149              b'and&nbsp;rFC1952.&nbsp;&nbsp;Things<br>\nthat&nbsp;start&nbsp;'
00150              b'with&nbsp;http&nbsp;and&nbsp;ftp&nbsp;should&nbsp;be&nbsp;'
00151              b'auto-linked,&nbsp;too:<br>\n<a href="http://google.com">'
00152              b'http://google.com</a>.</tt></dd></dl>'), response)

Here is the call graph for this function:

Definition at line 106 of file test_docxmlrpc.py.

00106 
00107     def test_invalid_get_response(self):
00108         self.client.request("GET", "/spam")
00109         response = self.client.getresponse()
00110 
00111         self.assertEqual(response.status, 404)
00112         self.assertEqual(response.getheader("Content-type"), "text/plain")
00113 
00114         response.read()

Here is the call graph for this function:

Test that lambda functionality stays the same.  The output produced
currently is, I suspect invalid because of the unencoded brackets in the
HTML, "<lambda>".

The subtraction lambda method is tested.

Definition at line 115 of file test_docxmlrpc.py.

00115 
00116     def test_lambda(self):
00117         """Test that lambda functionality stays the same.  The output produced
00118         currently is, I suspect invalid because of the unencoded brackets in the
00119         HTML, "<lambda>".
00120 
00121         The subtraction lambda method is tested.
00122         """
00123         self.client.request("GET", "/")
00124         response = self.client.getresponse()
00125 
00126         self.assertIn((b'<dl><dt><a name="-&lt;lambda&gt;"><strong>'
00127                        b'&lt;lambda&gt;</strong></a>(x, y)</dt></dl>'),
00128                       response.read())

Here is the call graph for this function:

Test the precense of three consecutive system.* methods.

This also tests their use of parameter type recognition and the
systems related to that process.

Definition at line 155 of file test_docxmlrpc.py.

00155 
00156     def test_system_methods(self):
00157         """Test the precense of three consecutive system.* methods.
00158 
00159         This also tests their use of parameter type recognition and the
00160         systems related to that process.
00161         """
00162         self.client.request("GET", "/")
00163         response = self.client.getresponse().read()
00164 
00165         self.assertIn(
00166             (b'<dl><dt><a name="-system.methodHelp"><strong>system.methodHelp'
00167              b'</strong></a>(method_name)</dt><dd><tt><a href="#-system.method'
00168              b'Help">system.methodHelp</a>(\'add\')&nbsp;=&gt;&nbsp;"Adds&nbsp;'
00169              b'two&nbsp;integers&nbsp;together"<br>\n&nbsp;<br>\nReturns&nbsp;a'
00170              b'&nbsp;string&nbsp;containing&nbsp;documentation&nbsp;for&nbsp;'
00171              b'the&nbsp;specified&nbsp;method.</tt></dd></dl>\n<dl><dt><a name'
00172              b'="-system.methodSignature"><strong>system.methodSignature</strong>'
00173              b'</a>(method_name)</dt><dd><tt><a href="#-system.methodSignature">'
00174              b'system.methodSignature</a>(\'add\')&nbsp;=&gt;&nbsp;[double,&nbsp;'
00175              b'int,&nbsp;int]<br>\n&nbsp;<br>\nReturns&nbsp;a&nbsp;list&nbsp;'
00176              b'describing&nbsp;the&nbsp;signature&nbsp;of&nbsp;the&nbsp;method.'
00177              b'&nbsp;In&nbsp;the<br>\nabove&nbsp;example,&nbsp;the&nbsp;add&nbsp;'
00178              b'method&nbsp;takes&nbsp;two&nbsp;integers&nbsp;as&nbsp;arguments'
00179              b'<br>\nand&nbsp;returns&nbsp;a&nbsp;double&nbsp;result.<br>\n&nbsp;'
00180              b'<br>\nThis&nbsp;server&nbsp;does&nbsp;NOT&nbsp;support&nbsp;system'
00181              b'.methodSignature.</tt></dd></dl>\n<dl><dt><a name="-test_method">'
00182              b'<strong>test_method</strong></a>(arg)</dt><dd><tt>Test&nbsp;'
00183              b'method\'s&nbsp;docs.&nbsp;This&nbsp;method&nbsp;truly&nbsp;does'
00184              b'&nbsp;very&nbsp;little.</tt></dd></dl>'), response)

Here is the call graph for this function:

Definition at line 96 of file test_docxmlrpc.py.

00096 
00097     def test_valid_get_response(self):
00098         self.client.request("GET", "/")
00099         response = self.client.getresponse()
00100 
00101         self.assertEqual(response.status, 200)
00102         self.assertEqual(response.getheader("Content-type"), "text/html")
00103 
00104         # Server throws an exception if we don't start to read the data
00105         response.read()

Here is the call graph for this function:


Member Data Documentation

Definition at line 72 of file test_docxmlrpc.py.

Definition at line 85 of file test_docxmlrpc.py.

Definition at line 76 of file test_docxmlrpc.py.


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