[Zope3-checkins] CVS: Zope3/src/zope/publisher/tests - test_http.py:1.16
Albertas Agejevas
alga@codeworks.lt
Mon, 9 Jun 2003 12:39:46 -0400
Update of /cvs-repository/Zope3/src/zope/publisher/tests
In directory cvs.zope.org:/tmp/cvs-serv9936/src/zope/publisher/tests
Modified Files:
test_http.py
Log Message:
Make authenticated principal name appear in the hit logs.
This forced us to do some marginal hockery that is best removed when the
HTTP server machinery is refactored. More info in the comments.
=== Zope3/src/zope/publisher/tests/test_http.py 1.15 => 1.16 ===
--- Zope3/src/zope/publisher/tests/test_http.py:1.15 Mon Apr 28 09:14:22 2003
+++ Zope3/src/zope/publisher/tests/test_http.py Mon Jun 9 12:39:15 2003
@@ -25,6 +25,11 @@
from StringIO import StringIO
+class UserStub:
+ def __init__(self, id):
+ self._id = id
+ def getId(self):
+ return self._id
class HTTPTests(unittest.TestCase):
@@ -197,6 +202,15 @@
req = self._createRequest(env)
lpw = req._authUserPW()
self.assertEquals(lpw, (login, password))
+
+ def testSetUser(self):
+ class HTTPTaskStub:
+ def setAuthUserName(self, name):
+ self.auth_user_name = name
+ task = HTTPTaskStub()
+ req = self._createRequest(outstream=task)
+ req.setUser(UserStub("jim"))
+ self.assertEquals(req.response._outstream.auth_user_name, "jim")
def testIPresentationRequest(self):
# test the IView request