[Checkins] SVN: zope.app.testing/trunk/ Include REMOTE_ADDR ('127.0.0.1') in the request environment.
Marius Gedminas
marius at pov.lt
Fri Jan 7 14:50:07 EST 2011
Log message for revision 119446:
Include REMOTE_ADDR ('127.0.0.1') in the request environment.
Changed:
U zope.app.testing/trunk/CHANGES.txt
U zope.app.testing/trunk/src/zope/app/testing/functional.py
U zope.app.testing/trunk/src/zope/app/testing/tests.py
-=-
Modified: zope.app.testing/trunk/CHANGES.txt
===================================================================
--- zope.app.testing/trunk/CHANGES.txt 2011-01-07 17:08:34 UTC (rev 119445)
+++ zope.app.testing/trunk/CHANGES.txt 2011-01-07 19:50:06 UTC (rev 119446)
@@ -5,7 +5,7 @@
3.8.1 (unreleased)
------------------
-- Nothing changed yet.
+- Include REMOTE_ADDR ('127.0.0.1') in the request environment.
3.8.0 (2010-09-14)
Modified: zope.app.testing/trunk/src/zope/app/testing/functional.py
===================================================================
--- zope.app.testing/trunk/src/zope/app/testing/functional.py 2011-01-07 17:08:34 UTC (rev 119445)
+++ zope.app.testing/trunk/src/zope/app/testing/functional.py 2011-01-07 19:50:06 UTC (rev 119446)
@@ -711,6 +711,7 @@
"HTTP_HOST": 'localhost',
"REQUEST_METHOD": method,
"SERVER_PROTOCOL": protocol,
+ "REMOTE_ADDR": '127.0.0.1',
}
headers = [split_header(header)
Modified: zope.app.testing/trunk/src/zope/app/testing/tests.py
===================================================================
--- zope.app.testing/trunk/src/zope/app/testing/tests.py 2011-01-07 17:08:34 UTC (rev 119445)
+++ zope.app.testing/trunk/src/zope/app/testing/tests.py 2011-01-07 19:50:06 UTC (rev 119446)
@@ -272,7 +272,15 @@
self.assertRaises(KeyError, response._request.environment.__getitem__,
'HTTP_REFERER')
+ def testRemoteAddr(self):
+ # There should be a REMOTE_ADDR in the request by default.
+ from zope.app.testing.functional import HTTPCaller
+ http = HTTPCaller()
+ response = http("GET / HTTP/1.1\n\n")
+ self.assertEqual(response._request.environment['REMOTE_ADDR'],
+ '127.0.0.1')
+
class GetCookies(object):
"""Get all cookies set."""
More information about the checkins
mailing list