[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication/tests - testZopePublication.py:1.1.2.2
Chris McDonough
chrism@zope.com
Fri, 30 Nov 2001 15:53:53 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication/tests
In directory cvs.zope.org:/tmp/cvs-serv7862
Modified Files:
Tag: Zope-3x-branch
testZopePublication.py
Log Message:
Made tests pass.
=== Zope3/lib/python/Zope/App/ZopePublication/tests/testZopePublication.py 1.1.2.1 => 1.1.2.2 ===
verify(interface, DefaultPublication)
+ def _createRequest(self, path, publication):
+ outstream = StringIO()
+ response = BaseResponse(outstream)
+ instream = StringIO("")
+ request = BaseRequest(response, instream, publication)
+ request.other['PATH_INFO'] = path
+ return request
class ZopePublicationTests(BasePublicationTests):
klass = ZopePublication
@@ -54,7 +61,7 @@
def testNativeTraverseNameWrapping(self):
pub = self.klass(self.db)
ob = DummyPublished()
- ob2 = pub.traverseName(self._createRequest('/bruce'), ob, 'bruce')
+ ob2 = pub.traverseName(self._createRequest('/bruce',pub), ob, 'bruce')
self.failUnless(ob2 is not ob)
self.failUnless(type(ob2) is Wrapper)
@@ -82,7 +89,7 @@
ob['bruce'] = 'bruce'
ob['bruce2'] = 'bruce2'
pub = self.klass(self.db)
- ob2 = pub.traverseName(self._createRequest('/bruce'), ob, 'bruce')
+ ob2 = pub.traverseName(self._createRequest('/bruce',pub), ob, 'bruce')
self.failUnless(type(ob2) is Wrapper)
unw = getobject(ob2)
self.assertEqual(unw, 'bruce')
@@ -99,11 +106,9 @@
__implements__ = IBrowserPublisher
def __init__(self, context):
self.context = context
- self.counter = 0
- def browser_traverse(self, request, name):
- self.counter+=1
- return self.context[name]
+ def browser_default(self, request):
+ return (self.context['bruce'], None)
from Zope.ComponentArchitecture import providePresentation
providePresentation(I1, '_traverse', IBrowserPublisher, Adapter)
@@ -111,7 +116,7 @@
ob['bruce'] = 'bruce'
ob['bruce2'] = 'bruce2'
pub = self.klass(self.db)
- ob2,x = pub.getDefaultTraversal(self._createRequest('/bruce'), ob)
+ ob2,x = pub.getDefaultTraversal(self._createRequest('/bruce',pub), ob)
self.failUnless(type(ob2) is Wrapper)
unw = getobject(ob2)
self.assertEqual(unw, 'bruce')