Source

CherryPy / cherrypy / test / webtest.py

Diff from to

cherrypy/test/webtest.py

 be of further significance to your tests).
 """
 
-import os
 import pprint
 import re
 import socket
     status = None
     headers = None
     body = None
-    
+
     encoding = 'utf-8'
-    
+
     time = None
 
     def get_conn(self, auto_open=False):
     def getPage(self, url, headers=None, method="GET", body=None, protocol=None):
         """Open the url with debugging support. Return status, headers, body."""
         ServerError.on = False
-        
+
         if isinstance(url, unicodestr):
             url = url.encode('utf-8')
         if isinstance(body, unicodestr):
             body = body.encode('utf-8')
-        
+
         self.url = url
         self.time = None
         start = time.time()
                 def putrequest(self, method, url):
                     if self._HTTPConnection__response and self._HTTPConnection__response.isclosed():
                         self._HTTPConnection__response = None
-                    
+
                     if self._HTTPConnection__state == http.client._CS_IDLE:
                         self._HTTPConnection__state = http.client._CS_REQ_STARTED
                     else:
                         raise http.client.CannotSendRequest()
-                    
+
                     self._method = method
                     if not url:
-                        url = b'/'
-                    request = b' '.join((method.encode("ASCII"), url,
-                                         self._http_vsn_str.encode("ASCII")))
+                        url = ntob('/')
+                    request = ntob(' ').join((method.encode("ASCII"), url,
+                                              self._http_vsn_str.encode("ASCII")))
                     self._output(request)
                 import types
                 conn.putrequest = types.MethodType(putrequest, conn)
-                
+
                 conn.putrequest(method.upper(), url)
 
             for key, value in headers:
         print("")
         print("".join(traceback.format_exception(*exc)))
         return True
-