[Zope3-checkins] CVS: Zope3/src/zope/app/content/tests - test_dtmlpage.py:1.7 test_folder.py:1.11 test_sqlscript.py:1.15 test_zptpage.py:1.15

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


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

Modified Files:
	test_dtmlpage.py test_folder.py test_sqlscript.py 
	test_zptpage.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/content/tests/test_dtmlpage.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/content/tests/test_dtmlpage.py:1.6	Sun Sep 21 13:31:53 2003
+++ Zope3/src/zope/app/content/tests/test_dtmlpage.py	Fri Nov 21 12:12:01 2003
@@ -25,7 +25,7 @@
 from zope.app.tests.placelesssetup import PlacelessSetup
 from zope.app.traversing.adapters import Traverser, DefaultTraversable
 from zope.app.interfaces.traversing import ITraverser, ITraversable
-from zope.component.adapter import provideAdapter
+from zope.app.tests import ztapi
 from zope.security.checker import NamesChecker, defineChecker
 from zope.app.container.contained import contained
 
@@ -43,8 +43,8 @@
 
     def setUp(self):
         PlacelessSetup.setUp(self)
-        provideAdapter(None, ITraverser, Traverser)
-        provideAdapter(None, ITraversable, DefaultTraversable)
+        ztapi.provideAdapter(None, ITraverser, Traverser)
+        ztapi.provideAdapter(None, ITraversable, DefaultTraversable)
         defineChecker(Data, NamesChecker(['URL', 'name', '__getitem__']))
 
     def test(self):


=== Zope3/src/zope/app/content/tests/test_folder.py 1.10 => 1.11 ===
--- Zope3/src/zope/app/content/tests/test_folder.py:1.10	Sun Sep 21 13:32:01 2003
+++ Zope3/src/zope/app/content/tests/test_folder.py	Fri Nov 21 12:12:01 2003
@@ -13,7 +13,7 @@
 ##############################################################################
 from unittest import TestCase, TestSuite, main, makeSuite
 from zope.component import getAdapter
-from zope.component.adapter import provideAdapter
+from zope.app.tests import ztapi
 from zope.app.traversing import traverse
 from zope.app.interfaces.dublincore import IZopeDublinCore
 from zope.app.interfaces.content.folder import IFolder
@@ -45,7 +45,7 @@
     def setUp(self):
         PlacefulSetup.setUp(self)
         PlacefulSetup.buildFolders(self)
-        provideAdapter(IFolder, IZopeDublinCore, ZDCAnnotatableAdapter)
+        ztapi.provideAdapter(IFolder, IZopeDublinCore, ZDCAnnotatableAdapter)
 
 def test_suite():
     return TestSuite((


=== Zope3/src/zope/app/content/tests/test_sqlscript.py 1.14 => 1.15 ===
--- Zope3/src/zope/app/content/tests/test_sqlscript.py:1.14	Tue Aug 19 13:34:15 2003
+++ Zope3/src/zope/app/content/tests/test_sqlscript.py	Fri Nov 21 12:12:01 2003
@@ -15,7 +15,7 @@
 $Id$
 """
 import unittest
-
+from zope.app.tests import ztapi
 from zope.interface import implements, classImplements
 
 from zope.app.interfaces.rdb import IConnectionService
@@ -136,13 +136,13 @@
         self.caching_service = CachingServiceStub()
         sm.defineService('Caching', ICachingService)
         sm.provideService('Caching', self.caching_service)
-        getService(None, Adapters).provideAdapter(
+        ztapi.provideAdapter(
             IAttributeAnnotatable, IAnnotations,
             AttributeAnnotations)
-        getService(None, Adapters).provideAdapter(
+        ztapi.provideAdapter(
             ISQLScript, IPhysicallyLocatable,
             LocatableStub)
-        getService(None, Adapters).provideAdapter(
+        ztapi.provideAdapter(
             IAnnotatable, ICacheable,
             AnnotationCacheable)
 


=== Zope3/src/zope/app/content/tests/test_zptpage.py 1.14 => 1.15 ===
--- Zope3/src/zope/app/content/tests/test_zptpage.py:1.14	Sun Sep 21 13:31:53 2003
+++ Zope3/src/zope/app/content/tests/test_zptpage.py	Fri Nov 21 12:12:01 2003
@@ -19,6 +19,7 @@
 
 import unittest
 
+from zope.app.tests import ztapi
 from zope.interface.verify import verifyClass
 from zope.exceptions import Forbidden
 
@@ -27,8 +28,6 @@
 from zope.app.interfaces.content.zpt import IZPTPage
 from zope.app.interfaces.index.text import ISearchableText
 from zope.component import getAdapter, getView
-from zope.component.view import provideView
-from zope.publisher.interfaces.browser import IBrowserPresentation
 from zope.publisher.browser import TestRequest, BrowserView
 
 # Wow, this is a lot of work. :(
@@ -36,7 +35,7 @@
 from zope.app.traversing.adapters import Traverser, DefaultTraversable
 from zope.app.interfaces.traversing import ITraverser
 from zope.app.interfaces.traversing import ITraversable
-from zope.component.adapter import provideAdapter
+from zope.app.tests import ztapi
 from zope.security.checker import NamesChecker, defineChecker
 from zope.app.container.contained import contained
 
@@ -50,12 +49,11 @@
 
     def setUp(self):
         PlacelessSetup.setUp(self)
-        provideAdapter(None, ITraverser, Traverser)
-        provideAdapter(None, ITraversable, DefaultTraversable)
-        provideAdapter(IZPTPage, ISearchableText, SearchableText)
+        ztapi.provideAdapter(None, ITraverser, Traverser)
+        ztapi.provideAdapter(None, ITraversable, DefaultTraversable)
+        ztapi.provideAdapter(IZPTPage, ISearchableText, SearchableText)
         defineChecker(Data, NamesChecker(['URL', 'name']))
-        defineChecker(TestRequest, NamesChecker(['getPresentationType',
-                                                 'getPresentationSkin']))
+        defineChecker(TestRequest, NamesChecker(['getPresentationSkin']))
 
     def testSearchableText(self):
         page = ZPTPage()
@@ -121,7 +119,7 @@
         from zope.app.traversing.namespace import provideNamespaceHandler
         from zope.app.traversing.namespace import view
         provideNamespaceHandler('view', view)
-        provideView(IZPTPage, 'name', IBrowserPresentation, AU)
+        ztapi.browserView(IZPTPage, 'name', AU)
 
         page = ZPTPage()
         page.setSource(
@@ -129,7 +127,6 @@
             )
         page = contained(page, None, name='zpt')
         request = TestRequest()
-        request.setViewType(IBrowserPresentation)
         self.assertEquals(page.render(request), 'zpt\n')
 
 
@@ -197,7 +194,7 @@
 
     def setUp(self):
         PlacelessSetup.setUp(self)
-        provideView(IZPTPage, 'source.html', IBrowserPresentation, ZPTSourceView)
+        ztapi.browserView(IZPTPage, 'source.html', ZPTSourceView)
 
     def testSourceView(self):
         page = ZPTPage()




More information about the Zope3-Checkins mailing list