[Zope3-checkins] CVS: Zope3/src/zope/component/tests - test_api.py:1.13.8.1

Garrett Smith garrett at mojave-corp.com
Thu Feb 26 00:11:29 EST 2004


Update of /cvs-repository/Zope3/src/zope/component/tests
In directory cvs.zope.org:/tmp/cvs-serv25181/src/zope/component/tests

Modified Files:
      Tag: garrett-widgets2-branch
	test_api.py 
Log Message:
Yet another branch for widgets refactoring (YABFWR).


=== Zope3/src/zope/component/tests/test_api.py 1.13 => 1.13.8.1 ===
--- Zope3/src/zope/component/tests/test_api.py:1.13	Mon Feb  9 02:41:21 2004
+++ Zope3/src/zope/component/tests/test_api.py	Thu Feb 26 00:10:59 2004
@@ -270,6 +270,42 @@
         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):
 
         from zope.component import getResource, queryResource, getService




More information about the Zope3-Checkins mailing list