[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher/tests - testPublisher.py:1.1.2.7.2.1
Jim Fulton
jim@zope.com
Sat, 16 Mar 2002 09:44:02 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/Publisher/tests
In directory cvs.zope.org:/tmp/cvs-serv24057/python/Zope/Publisher/tests
Modified Files:
Tag: Zope3-publisher-refactor-branch
testPublisher.py
Log Message:
Checking in partial publisher refactoring on the
Zope3-publisher-refactor-branch branch to facilitate collaboration
with Stephan.
=== Zope3/lib/python/Zope/Publisher/tests/testPublisher.py 1.1.2.7 => 1.1.2.7.2.1 ===
from Zope.Publisher.Publish import publish
from Zope.Publisher.BaseRequest import BaseRequest
-from Zope.Publisher.BaseResponse import BaseResponse
from Zope.Publisher.DefaultPublication import DefaultPublication
from Zope.Publisher.Exceptions import Retry, Unauthorized, NotFound, DebugError
from Zope.Publisher.IPublication import IPublication
@@ -59,17 +58,17 @@
def _createRequest(self, path):
publication = TestPublication(self.app)
- outstream = StringIO()
- response = BaseResponse(outstream)
- instream = StringIO("")
- request = BaseRequest(response, instream, publication)
- request.other['PATH_INFO'] = path
+ path = path.split('/')
+ path.reverse()
+ request = BaseRequest(StringIO(''), StringIO(), {})
+ request.setTraversalStack(path)
+ request.setPublication(publication)
return request
def _publisherResults(self, path):
request = self._createRequest(path)
publish(request)
- return request.response.outstream.getvalue()
+ return request.getResponse().outstream.getvalue()
def testImplementsIPublication(self):
self.failUnless(IPublication.isImplementedBy(
@@ -83,10 +82,6 @@
res = self._publisherResults('/folder/item')
self.failUnlessEqual(res, 'item')
res = self._publisherResults('/folder/item/')
- self.failUnlessEqual(res, 'item')
- res = self._publisherResults('/folder/./item')
- self.failUnlessEqual(res, 'item')
- res = self._publisherResults('/folder/../folder/item/../item')
self.failUnlessEqual(res, 'item')
res = self._publisherResults('folder/item')
self.failUnlessEqual(res, 'item')