[Checkins] SVN: z3c.jsonrpc/trunk/ - Fix ``JSONRPCTestTransport`` to include the request full host.
Adam Groszer
cvs-admin at zope.org
Tue Nov 27 14:03:13 UTC 2012
Log message for revision 128444:
- Fix ``JSONRPCTestTransport`` to include the request full host.
Until now it ate the port.
Changed:
U z3c.jsonrpc/trunk/CHANGES.txt
U z3c.jsonrpc/trunk/src/z3c/jsonrpc/testing.py
-=-
Modified: z3c.jsonrpc/trunk/CHANGES.txt
===================================================================
--- z3c.jsonrpc/trunk/CHANGES.txt 2012-11-27 13:14:52 UTC (rev 128443)
+++ z3c.jsonrpc/trunk/CHANGES.txt 2012-11-27 14:03:12 UTC (rev 128444)
@@ -5,7 +5,8 @@
0.7.1 (unreleased)
------------------
-- ...
+- Fix ``JSONRPCTestTransport`` to include the request full host.
+ Until now it ate the port.
0.7.0 (2012-03-25)
Modified: z3c.jsonrpc/trunk/src/z3c/jsonrpc/testing.py
===================================================================
--- z3c.jsonrpc/trunk/src/z3c/jsonrpc/testing.py 2012-11-27 13:14:52 UTC (rev 128443)
+++ z3c.jsonrpc/trunk/src/z3c/jsonrpc/testing.py 2012-11-27 14:03:12 UTC (rev 128444)
@@ -44,7 +44,7 @@
class JSONRPCTestTransport(Transport):
"""Test transport that delegates to zope.app.testing.functional.HTTPCaller.
- It can be used like a normal transport, including support for basic
+ It can be used like a normal transport, including support for basic
authentication.
"""
@@ -61,6 +61,7 @@
request += "Authorization: %s\n" % (
dict(extra_headers)["Authorization"],)
+ request += "Host: %s\n" % host
request += "\n" + request_body
caller = HTTPCaller()
response = caller(request, handle_errors=self.handleErrors)
@@ -80,7 +81,7 @@
def JSONRPCTestProxy(uri, transport=None, encoding=None, verbose=None,
jsonId=None, handleErrors=True, jsonVersion=JSON_RPC_VERSION):
- """A factory that creates a server proxy using the ZopeJSONRPCTestTransport
+ """A factory that creates a server proxy using the ZopeJSONRPCTestTransport
by default."""
if verbose is None:
verbose = 0
@@ -98,8 +99,8 @@
###############################################################################
functional.defineLayer("JSONRPCTestingLayer", "ftesting.zcml")
-
+
###############################################################################
#
# Test component
@@ -189,15 +190,15 @@
request_cls, publication_cls = \
super(HTTPCaller, self).chooseRequestClass(method, path,
environment)
-
+
content_type = environment.get('CONTENT_TYPE', '')
is_json = content_type.startswith('application/json')
-
+
if method in ('GET', 'POST', 'HEAD'):
if (method == 'POST' and is_json):
request_cls = JSONRPCRequest
publication_cls = JSONRPCPublication
-
+
return request_cls, publication_cls
@@ -260,7 +261,7 @@
class FakeModule:
"""A fake module."""
-
+
def __init__(self, dict):
self.__dict = dict
@@ -278,7 +279,7 @@
else:
name = test.globs.name
- test.globs['__name__'] = name
+ test.globs['__name__'] = name
test.globs = NoCopyDict(test.globs)
sys.modules[name] = FakeModule(test.globs)
More information about the checkins
mailing list