[Zope3-checkins] CVS: Zope3/src/zope/component/tests -
test_api.py:1.18
Jim Fulton
jim at zope.com
Thu Mar 18 07:19:28 EST 2004
Update of /cvs-repository/Zope3/src/zope/component/tests
In directory cvs.zope.org:/tmp/cvs-serv2130/src/zope/component/tests
Modified Files:
test_api.py
Log Message:
Added queryMultiView
=== Zope3/src/zope/component/tests/test_api.py 1.17 => 1.18 ===
--- Zope3/src/zope/component/tests/test_api.py:1.17 Mon Mar 15 15:42:22 2004
+++ Zope3/src/zope/component/tests/test_api.py Thu Mar 18 07:19:27 2004
@@ -266,6 +266,37 @@
self.assertEquals(c.__class__, Comp)
self.assertEquals(c.context, ob)
+ def testMultiView(self):
+ from zope.component import queryMultiView, getService
+ from zope.component.exceptions import ComponentLookupError
+
+ class Ob2:
+ implements(I2)
+
+ ob2 = Ob2()
+
+ class IRequest(Interface):
+ pass
+
+ request = Request(IRequest)
+
+ class MV:
+ implements(I3)
+ def __init__(self, context, other, request):
+ self.context, self.other, self.request = context, other, request
+
+ self.assertEquals(
+ queryMultiView((ob, ob2), 'foo', request, I3, 42), 42)
+
+ getService(None, servicenames.Presentation).provideAdapter(
+ IRequest, MV, 'foo', (I1, I2), I3)
+
+ view = queryMultiView((ob, ob2), 'foo', request, I3)
+ self.assertEquals(view.__class__, MV)
+ self.assertEquals(view.context, ob)
+ self.assertEquals(view.other, ob2)
+ self.assertEquals(view.request, request)
+
def test_viewProvidingFunctions(self):
# Confirm that a call to getViewProving/queryViewProviding simply
# passes its arguments through to getView/queryView - here we hack
More information about the Zope3-Checkins
mailing list