[Zope3-checkins] CVS: Zope3/src/zope/component/tests -
test_api.py:1.12.10.1
Garrett Smith
garrett at mojave-corp.com
Sun Feb 8 18:54:26 EST 2004
Update of /cvs-repository/Zope3/src/zope/component/tests
In directory cvs.zope.org:/tmp/cvs-serv22019/src/zope/component/tests
Modified Files:
Tag: ozzope-widgets-branch
test_api.py
Log Message:
Multiple changes:
- Added getViewProviding and queryViewProviding methods to zapi. These are
used to lookup a view based on an interface it provides.
- Fixed a misspecified interface in rotterdamn textarea edit widget.
- Rework of utility.py in progress - tests broken.
- Removed the old view service.
=== Zope3/src/zope/component/tests/test_api.py 1.12 => 1.12.10.1 ===
--- Zope3/src/zope/component/tests/test_api.py:1.12 Wed Dec 17 05:07:00 2003
+++ Zope3/src/zope/component/tests/test_api.py Sun Feb 8 18:54:25 2004
@@ -250,6 +250,42 @@
c = getView(ob, 'foo', Request(I2), providing=I3)
self.assertEquals(c.__class__, Comp)
self.assertEquals(c.context, ob)
+
+ def test_viewProvidingFunctions(self):
+ # Confirm that a call to getViewProving/queryViewProviding simply
+ # passes its arguments through to getView/queryView - here we hack
+ # getView and queryView to inspect the args passed through.
+ import zope.component
+
+ # hack zope.component.getView
+ def getView(object, name, request, context, providing):
+ self.args = [object, name, request, context, providing]
+ savedGetView = zope.component.getView
+ zope.component.getView = getView
+
+ # confirm pass through of args to getView by way of getViewProviding
+ zope.component.getViewProviding(
+ object='object', providing='providing', request='request',
+ context='context')
+ self.assertEquals(self.args,
+ ['object', '', 'request', 'context', 'providing'])
+
+ # hack zope.component.queryView
+ def queryView(object, name, request, default, context, providing):
+ self.args = [object, name, request, default, context, providing]
+ savedQueryView = zope.component.queryView
+ zope.component.queryView = queryView
+
+ # confirm pass through of args to queryView by way of queryViewProviding
+ zope.component.queryViewProviding(
+ object='object', providing='providing', request='request',
+ default='default', context='context')
+ self.assertEquals(self.args,
+ ['object', '', 'request', 'default', 'context', 'providing'])
+
+ # restore zope.component
+ zope.component.getView = savedGetView
+ zope.component.queryView = savedQueryView
def testResource(self):
More information about the Zope3-Checkins
mailing list