[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services/registration/tests - test_componentpathwidget.py:1.4 test_editregistration.py:1.4 test_namecomponentregistryview.py:1.2

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


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

Modified Files:
	test_componentpathwidget.py test_editregistration.py 
	test_namecomponentregistryview.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/services/registration/tests/test_componentpathwidget.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/services/registration/tests/test_componentpathwidget.py:1.3	Sun Sep 21 13:30:59 2003
+++ Zope3/src/zope/app/browser/services/registration/tests/test_componentpathwidget.py	Fri Nov 21 12:11:57 2003
@@ -18,6 +18,7 @@
 __metaclass__ = type
 
 import unittest
+from zope.app.tests import ztapi
 from zope.app.browser.services.registration import ComponentPathWidget
 from zope.app.interfaces.services.registration import IComponentRegistration
 from zope.app.interfaces.traversing import IPhysicallyLocatable
@@ -25,12 +26,10 @@
 from zope.app.services.field import ComponentPath
 from zope.app.location import LocationPhysicallyLocatable
 from zope.app.traversing.adapters import Traverser, DefaultTraversable
-from zope.component.adapter import provideAdapter
-from zope.component.view import provideView
+from zope.app.tests import ztapi
 from zope.component.tests.placelesssetup import PlacelessSetup
 from zope.interface import implements, Interface
 from zope.publisher.browser import TestRequest, BrowserView
-from zope.publisher.interfaces.browser import IBrowserPresentation
 from zope.app.container.contained import Contained
 
 class Component:
@@ -58,11 +57,11 @@
 
     def setUp(self):
         PlacelessSetup.setUp(self)
-        provideAdapter(None, ITraverser, Traverser)
-        provideAdapter(None, ITraversable, DefaultTraversable)
-        provideAdapter(None, IPhysicallyLocatable, LocationPhysicallyLocatable)
-        provideView(Interface, "absolute_url", IBrowserPresentation,
-                    AbsoluteURL)
+        ztapi.provideAdapter(None, ITraverser, Traverser)
+        ztapi.provideAdapter(None, ITraversable, DefaultTraversable)
+        ztapi.provideAdapter(None, IPhysicallyLocatable,
+                             LocationPhysicallyLocatable)
+        ztapi.browserView(Interface, "absolute_url", AbsoluteURL)
 
         field = ComponentPath(None, title=u"Path")
         field.__name__ = u'path'


=== Zope3/src/zope/app/browser/services/registration/tests/test_editregistration.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/services/registration/tests/test_editregistration.py:1.3	Sun Sep 21 13:31:00 2003
+++ Zope3/src/zope/app/browser/services/registration/tests/test_editregistration.py	Fri Nov 21 12:11:57 2003
@@ -19,6 +19,7 @@
 """
 __metaclass__ = type
 
+from zope.app.tests import ztapi
 from unittest import TestCase, TestSuite, main, makeSuite
 from zope.app.browser.services.registration import EditRegistration
 from zope.app.event.tests.placelesssetup import getEvents
@@ -28,11 +29,9 @@
 from zope.app.interfaces.services.registration import ActiveStatus
 from zope.app.interfaces.traversing import IContainmentRoot
 from zope.app.services.tests.placefulsetup import PlacefulSetup
-from zope.component.view import provideView
 from zope.interface import Interface, implements
 from zope.publisher.browser import BrowserView
 from zope.publisher.browser import TestRequest
-from zope.publisher.interfaces.browser import IBrowserPresentation
 from zope.app.container.contained import Contained
 
 class Container(dict):
@@ -63,7 +62,7 @@
             def setPrefix(self, p):
                 self._prefix = p
 
-        provideView(I, 'ItemEdit', IBrowserPresentation, V)
+        ztapi.browserView(I, 'ItemEdit', V)
 
         c1 = C()
         c2 = C()


=== Zope3/src/zope/app/browser/services/registration/tests/test_namecomponentregistryview.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/browser/services/registration/tests/test_namecomponentregistryview.py:1.1	Sat Jun 21 17:22:03 2003
+++ Zope3/src/zope/app/browser/services/registration/tests/test_namecomponentregistryview.py	Fri Nov 21 12:11:57 2003
@@ -16,13 +16,12 @@
 $Id$
 """
 
+from zope.app.tests import ztapi
 from unittest import TestCase, TestSuite, main, makeSuite
 from zope.interface import Interface, implements
 from zope.publisher.browser import TestRequest
 from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.publisher.interfaces.browser import IBrowserPresentation
-from zope.component.view import provideView
-from zope.component.adapter import provideAdapter
+from zope.app.tests import ztapi
 from zope.publisher.browser import BrowserView
 from zope.app.browser.services.registration import NameComponentRegistryView
 from zope.app.interfaces.traversing import ITraversable, ITraverser
@@ -81,10 +80,9 @@
 class Test(PlacelessSetup, TestCase):
 
     def test_update(self):
-        provideAdapter(None, ITraverser, Traverser)
-        provideView(I, 'ChangeRegistrations', IBrowserPresentation, V)
-        provideView(ITestRegistration, 'absolute_url', IBrowserPresentation,
-                    AU)
+        ztapi.provideAdapter(None, ITraverser, Traverser)
+        ztapi.browserView(I, 'ChangeRegistrations', V)
+        ztapi.browserView(ITestRegistration, 'absolute_url', AU)
 
         r1 = Registry(None)
         r2 = Registry(Registration('1'))




More information about the Zope3-Checkins mailing list