[Zope3-checkins] CVS: Zope3/src/zope/app/browser/container/tests - test_adding.py:1.5 test_contents.py:1.18
Steve Alexander
steve@cat-box.net
Thu, 5 Jun 2003 08:03:44 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser/container/tests
In directory cvs.zope.org:/tmp/cvs-serv15171/src/zope/app/browser/container/tests
Modified Files:
test_adding.py test_contents.py
Log Message:
Placeful setup for tests now sets up a ZopeContainerDecorator.
This means that in such tests, you no longer need to use
ZopeContainerAdapter to get the correct events issued, and perform context-
wrapping duties, when you use a container.
However, it does mean that your tests need to expect these events and
context-wrappers to be used.
=== Zope3/src/zope/app/browser/container/tests/test_adding.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/container/tests/test_adding.py:1.4 Wed May 28 19:15:05 2003
+++ Zope3/src/zope/app/browser/container/tests/test_adding.py Thu Jun 5 08:03:13 2003
@@ -31,13 +31,12 @@
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 = {}
@@ -58,7 +57,6 @@
def setUp(self):
PlacelessSetup.setUp(self)
- provideAdapter(IContainer, IZopeContainer, ZopeContainerAdapter)
def test(self):
container = Container()
=== Zope3/src/zope/app/browser/container/tests/test_contents.py 1.17 => 1.18 ===
--- Zope3/src/zope/app/browser/container/tests/test_contents.py:1.17 Sun Jun 1 11:59:26 2003
+++ Zope3/src/zope/app/browser/container/tests/test_contents.py Thu Jun 5 08:03:13 2003
@@ -26,7 +26,6 @@
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,18 +43,16 @@
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.event.tests.placelesssetup import getEvents, clearEvents
from zope.app.interfaces.event import IObjectRemovedEvent, IObjectModifiedEvent
-from zope.interface import Interface
+from zope.interface import Interface, implements
from zope.proxy import removeAllProxies
from zope.app.interfaces.copypastemove import IPrincipalClipboard
from zope.app.copypastemove import PrincipalClipboard
from zope.component import getServiceManager
-from zope.app.services.principalannotation \
- import PrincipalAnnotationService
+from zope.app.services.principalannotation import PrincipalAnnotationService
from zope.app.interfaces.services.principalannotation \
import IPrincipalAnnotationService
from zope.app.interfaces.annotation import IAnnotations
@@ -72,8 +69,6 @@
def setUp(self):
PlacelessSetup.setUp(self)
- provideAdapter(IContainer, IZopeContainer, ZopeContainerAdapter)
- provideAdapter(ITraversable, IZopeContainer, ZopeContainerAdapter)
provideAdapter(None, IObjectMover, ObjectMover)
def testInfo(self):
@@ -108,7 +103,7 @@
from datetime import datetime
from zope.app.interfaces.dublincore import IZopeDublinCore
class FauxDCAdapter:
- __implements__ = IZopeDublinCore
+ implements(IZopeDublinCore)
def __init__(self, context):
pass
@@ -141,8 +136,14 @@
fc = self._TestView__newView(container)
- self.failIf(getEvents(IObjectModifiedEvent))
self.failIf(getEvents(IObjectRemovedEvent))
+ self.failUnless(
+ getEvents(IObjectModifiedEvent,
+ filter =
+ lambda event:
+ removeAllProxies(event.object) == container)
+ )
+ clearEvents()
fc.removeObjects(['document2'])
@@ -176,7 +177,7 @@
pass
class Document:
- __implements__ = IDocument
+ implements(IDocument)
class Principal:
@@ -186,12 +187,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)