[Zope3-checkins] CVS: Zope3/src/zope/app/browser/tests - test_introspector.py:1.3 test_menu.py:1.10

Jim Fulton cvs-admin at zope.org
Fri Nov 21 12:12:30 EST 2003


Update of /cvs-repository/Zope3/src/zope/app/browser/tests
In directory cvs.zope.org:/tmp/cvs-serv31883/src/zope/app/browser/tests

Modified Files:
	test_introspector.py test_menu.py 
Log Message:
Changed to use the new ztapi module, which provides handy functions
for setting up adapters and views for tests.  This is needed because
there are no-longer global adapter and view services sitting around as
module globals.


=== Zope3/src/zope/app/browser/tests/test_introspector.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/tests/test_introspector.py:1.2	Wed Jul  2 11:23:02 2003
+++ Zope3/src/zope/app/browser/tests/test_introspector.py	Fri Nov 21 12:11:59 2003
@@ -25,7 +25,7 @@
 from zope.interface import Interface, directlyProvidedBy
 from zope.interface import directlyProvides, implements
 from zope.app.component.globalinterfaceservice import provideInterface
-from zope.component.adapter import provideAdapter
+from zope.app.tests import ztapi
 from zope.app.interfaces.introspector import IIntrospector
 from zope.app.introspector import Introspector
 
@@ -49,7 +49,7 @@
 
         provideInterface(id, I1)
         provideInterface(id2, I2)
-        provideAdapter(None, IIntrospector, Introspector)
+        ztapi.provideAdapter(None, IIntrospector, Introspector)
 
 
     def test_getInterfaceURL(self):


=== Zope3/src/zope/app/browser/tests/test_menu.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/browser/tests/test_menu.py:1.9	Fri Jun  6 17:35:20 2003
+++ Zope3/src/zope/app/browser/tests/test_menu.py	Fri Nov 21 12:11:59 2003
@@ -17,17 +17,16 @@
 """
 
 import unittest
+
+from zope.app.tests import ztapi
 from zope.interface import Interface, implements
 
 from zope.component import getService, getServiceManager
-from zope.app.services.servicenames import Views
-from zope.app.services.tests.placefulsetup \
-           import PlacefulSetup
+from zope.app.services.tests.placefulsetup import PlacefulSetup
 
 from zope.app.browser.menu import MenuAccessView
-
+from zope.publisher.browser import TestRequest
 from zope.publisher.interfaces.browser import IBrowserView
-from zope.publisher.interfaces.browser import IBrowserPresentation
 from zope.app.publication.traversers import TestTraverser
 from zope.security.management import newSecurityManager
 from zope.security.checker import defineChecker, NamesChecker, CheckerPublic
@@ -81,29 +80,21 @@
 
         defineService('BrowserMenu', IBrowserMenuService)
         provideService('BrowserMenu', Service())
-        getService(None,Views).provideView(
-            I, 'a3', IBrowserPresentation, [V])
-        getService(None, Views).provideView(None, '_traverse',
-                            IBrowserPresentation, [TestTraverser])
+        ztapi.browserView(I, 'a3', [V])
+        ztapi.browserView(None, '_traverse', [TestTraverser])
         defineChecker(C, NamesChecker(['a1', 'a2', 'a3', '__call__'],
                                       CheckerPublic,
                                       abad='waaa'))
 
     def test(self):
         newSecurityManager('who')
-        v = MenuAccessView(ProxyFactory(ob), Request())
+        v = MenuAccessView(ProxyFactory(ob), TestRequest())
         self.assertEqual(v['zmi_views'],
                          [{'description': '', 'title':'l1', 'action':'a1'},
                           {'description': '', 'title':'l2', 'action':'a2/a3'},
                           {'description': '', 'title':'l3', 'action':'@@a3'}
                           ])
 
-
-class Request:
-    def getPresentationType(self):
-        return IBrowserPresentation
-    def getPresentationSkin(self):
-        return ''
 
 def test_suite():
     loader = unittest.TestLoader()




More information about the Zope3-Checkins mailing list