[Zope3-checkins] CVS: Zope3/src/zope/app/browser/container/tests - test_adding.py:1.2.26.1 test_contents.py:1.13.10.1

Steve Alexander steve@cat-box.net
Thu, 15 May 2003 10:49:56 -0400


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

Modified Files:
      Tag: stevea-decorators-branch
	test_adding.py test_contents.py 
Log Message:
More work on Decorators.
Converted existing tests to use decorators instead of ZopeContainerAdapter.


=== Zope3/src/zope/app/browser/container/tests/test_adding.py 1.2 => 1.2.26.1 ===
--- Zope3/src/zope/app/browser/container/tests/test_adding.py:1.2	Wed Dec 25 09:12:30 2002
+++ Zope3/src/zope/app/browser/container/tests/test_adding.py	Thu May 15 10:49:25 2003
@@ -22,23 +22,20 @@
 from zope.app.interfaces.container import IAdding
 from zope.app.tests.placelesssetup import PlacelessSetup
 from zope.component.view import provideView
-from zope.proxy.context \
-     import getWrapperObject, getWrapperContainer, getWrapperData
+from zope.proxy.context import getWrapperObject, getWrapperContainer
+from zope.proxy.context import getWrapperData, ContextWrapper
 from zope.publisher.browser import TestRequest
 from zope.publisher.browser import BrowserView
 from zope.publisher.interfaces.browser import IBrowserPresentation
 from zope.app.event.tests.placelesssetup import getEvents
 from zope.app.interfaces.event import IObjectAddedEvent, IObjectModifiedEvent
+from zope.app.component.decoratorservice import registerDecoratorForClass
 
-from zope.app.interfaces.container import IZopeContainer
 from zope.app.interfaces.container import IContainer
-from zope.app.container.zopecontainer import ZopeContainerAdapter
-
-
+from zope.interface import implements
 
 class Container:
-
-    __implements__ = IContainer
+    implements(IContainer)
 
     def __init__(self):
         self._data = {}
@@ -59,10 +56,13 @@
 
     def setUp(self):
         PlacelessSetup.setUp(self)
-        provideAdapter(IContainer, IZopeContainer, ZopeContainerAdapter)
+        registerDecoratorForClass(Container,
+                                  'zope.app.container.contextdecorator',
+                                  'context')
 
     def test(self):
         container = Container()
+        container = ContextWrapper(container, None)
         request = TestRequest()
         adding = Adding(container, request)
         provideView(IAdding, "Thing", IBrowserPresentation, CreationView)


=== Zope3/src/zope/app/browser/container/tests/test_contents.py 1.13 => 1.13.10.1 ===
--- Zope3/src/zope/app/browser/container/tests/test_contents.py:1.13	Wed Apr 30 19:37:50 2003
+++ Zope3/src/zope/app/browser/container/tests/test_contents.py	Thu May 15 10:49:25 2003
@@ -25,8 +25,6 @@
 from zope.app.interfaces.traversing import ITraversable
 from zope.app.interfaces.container import IZopeContainer
 from zope.app.interfaces.container import IContainer
-from zope.app.interfaces.copypastemove import IObjectMover
-from zope.app.container.zopecontainer import ZopeContainerAdapter
 
 from zope.app.traversing import traverse
 from zope.app.traversing import IObjectName
@@ -44,7 +42,6 @@
 from zope.app.container.copypastemove import MoveSource
 from zope.app.container.copypastemove import CopySource
 from zope.app.container.copypastemove import PasteNamesChooser
-from zope.app.container.zopecontainer import ZopeContainerAdapter
 
 from zope.app.event.tests.placelesssetup import getEvents
 from zope.app.interfaces.event import IObjectRemovedEvent, IObjectModifiedEvent
@@ -59,6 +56,7 @@
 from zope.app.interfaces.services.principalannotation \
     import IPrincipalAnnotationService
 from zope.app.interfaces.annotation import IAnnotations
+from zope.app.component.decoratorservice import registerDecoratorForClass
 
 class BaseTestContentsBrowserView(PlacelessSetup):
     """Base class for testing browser contents.
@@ -72,8 +70,6 @@
 
     def setUp(self):
         PlacelessSetup.setUp(self)
-        provideAdapter(IContainer, IZopeContainer, ZopeContainerAdapter)
-        provideAdapter(ITraversable, IZopeContainer, ZopeContainerAdapter)
         provideAdapter(None, IObjectMover, ObjectMover)
 
     def testInfo(self):
@@ -180,12 +176,10 @@
 
 
 class TestCutCopyPaste(PlacefulSetup, TestCase):
-    
+
     def setUp(self):
         PlacefulSetup.setUp(self)
         PlacefulSetup.buildFolders(self)
-        provideAdapter(IContainer, IZopeContainer, ZopeContainerAdapter)
-        provideAdapter(ITraversable, IZopeContainer, ZopeContainerAdapter)
         provideAdapter(None, IObjectCopier, ObjectCopier)
         provideAdapter(None, IObjectMover, ObjectMover)
         provideAdapter(IContainer, IPasteTarget, PasteTarget)
@@ -306,6 +300,7 @@
         from zope.app.content.folder import RootFolder
         from zope.proxy.context import ContextWrapper
         root = RootFolder()
+        root = ContextWrapper(root, None)
         container = SampleContainer()
         return ContextWrapper(container, root, name='sample')