[Checkins] SVN: z3c.jsonrpc/trunk/src/z3c/jsonrpc/testing.py Fix test failures.

Marius Gedminas cvs-admin at zope.org
Tue Feb 26 18:39:37 UTC 2013


Log message for revision 129856:
  Fix test failures.
  
  z3c.json was trying to feed unicode data into zope.publisher, which became
  stricter in version 4.0.0a1 and requires bytes (aka str on Python 2.x).
  
  And z3c.json did that because we didn't specify an encoding.
  
  

Changed:
  U   z3c.jsonrpc/trunk/src/z3c/jsonrpc/testing.py

-=-
Modified: z3c.jsonrpc/trunk/src/z3c/jsonrpc/testing.py
===================================================================
--- z3c.jsonrpc/trunk/src/z3c/jsonrpc/testing.py	2013-02-26 17:51:39 UTC (rev 129855)
+++ z3c.jsonrpc/trunk/src/z3c/jsonrpc/testing.py	2013-02-26 18:39:37 UTC (rev 129856)
@@ -63,6 +63,8 @@
 
         request += "Host: %s\n" % host
         request += "\n" + request_body
+        assert isinstance(request_body, bytes) # HTTPCaller won't like unicode
+        assert isinstance(request, bytes) # make sure handler/body are also bytes
         caller = HTTPCaller()
         response = caller(request, handle_errors=self.handleErrors)
 
@@ -79,7 +81,7 @@
             StringIO.StringIO(response.getBody()), sock=None)
 
 
-def JSONRPCTestProxy(uri, transport=None, encoding=None, verbose=None,
+def JSONRPCTestProxy(uri, transport=None, encoding='UTF-8', verbose=None,
     jsonId=None, handleErrors=True, jsonVersion=JSON_RPC_VERSION):
     """A factory that creates a server proxy using the ZopeJSONRPCTestTransport
     by default."""



More information about the checkins mailing list