[Zope3-checkins] CVS: Zope3/src/zope/app/browser/skins/basic/tests - test_standardmacros.py:1.8

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


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

Modified Files:
	test_standardmacros.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/skins/basic/tests/test_standardmacros.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/browser/skins/basic/tests/test_standardmacros.py:1.7	Fri Jun  6 17:35:18 2003
+++ Zope3/src/zope/app/browser/skins/basic/tests/test_standardmacros.py	Fri Nov 21 12:11:58 2003
@@ -17,13 +17,13 @@
 """
 
 import unittest
+from zope.app.tests import ztapi
 from zope.interface import implements
-from zope.app.services.tests.placefulsetup\
+from zope.app.services.tests.placefulsetup \
            import PlacefulSetup
 from zope.component import getService
-from zope.app.services.servicenames import Views
+from zope.publisher.browser import TestRequest
 from zope.publisher.interfaces.browser import IBrowserView
-from zope.publisher.interfaces.browser import IBrowserPresentation
 from zope.interface import Interface
 from zope.app.browser.skins.basic.standardmacros import Macros
 
@@ -48,12 +48,6 @@
 class C:
     implements(I)
 
-class Request:
-    def getPresentationType(self):
-        return IBrowserPresentation
-    def getPresentationSkin(self):
-        return ''
-
 class page1(ViewWithMacros):
     pages = {'foo':'page1_foo',
              'bar':'page1_bar'}
@@ -73,18 +67,15 @@
             self.context = context
             self.request = request
         macro_pages = pages
-    return T(C(), Request())
+    return T(C(), TestRequest())
 
 class Test(PlacefulSetup, unittest.TestCase):
 
     def setUp(self):
         PlacefulSetup.setUp(self)
-        provideView = getService(None,Views).provideView
-        provideView(I, 'page1', IBrowserPresentation, [page1])
-        provideView(I, 'collides_with_page1', IBrowserPresentation,
-                    [collides_with_page1])
-        provideView(I, 'works_with_page1', IBrowserPresentation,
-                    [works_with_page1])
+        ztapi.browserView(I, 'page1', [page1])
+        ztapi.browserView(I, 'collides_with_page1', [collides_with_page1])
+        ztapi.browserView(I, 'works_with_page1',  [works_with_page1])
 
     def testSinglePage(self):
         macros = createMacrosInstance(('page1',))




More information about the Zope3-Checkins mailing list