[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services/registration/tests - test_editregistration.py:1.3

Jim Fulton jim at zope.com
Sun Sep 21 13:31:00 EDT 2003


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

Modified Files:
	test_editregistration.py 
Log Message:
Use location framework rather than context wrappers.

Removed some checks for generated events because it is no longer the
responsibility of the view being tested to generate the events.


=== Zope3/src/zope/app/browser/services/registration/tests/test_editregistration.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/services/registration/tests/test_editregistration.py:1.2	Sun Aug 17 02:05:55 2003
+++ Zope3/src/zope/app/browser/services/registration/tests/test_editregistration.py	Sun Sep 21 13:31:00 2003
@@ -23,7 +23,8 @@
 from zope.app.browser.services.registration import EditRegistration
 from zope.app.event.tests.placelesssetup import getEvents
 from zope.app.interfaces.container import IContainer
-from zope.app.interfaces.event import IObjectModifiedEvent, IObjectRemovedEvent
+from zope.app.interfaces.container import IObjectRemovedEvent
+from zope.app.interfaces.event import IObjectModifiedEvent
 from zope.app.interfaces.services.registration import ActiveStatus
 from zope.app.interfaces.traversing import IContainmentRoot
 from zope.app.services.tests.placefulsetup import PlacefulSetup
@@ -32,7 +33,7 @@
 from zope.publisher.browser import BrowserView
 from zope.publisher.browser import TestRequest
 from zope.publisher.interfaces.browser import IBrowserPresentation
-from zope.app.context import ContextWrapper
+from zope.app.container.contained import Contained
 
 class Container(dict):
     implements(IContainer, IContainmentRoot)
@@ -40,7 +41,7 @@
 class I(Interface):
     pass
 
-class C:
+class C(Contained):
     implements(I)
     status = ActiveStatus
 
@@ -52,24 +53,10 @@
         c2 = C()
         c7 = C()
         d = Container({'1': c1, '2': c2, '7': c7})
-        d = ContextWrapper(d, None)
         view = EditRegistration(d, TestRequest())
         view.remove_objects(['2', '7'])
         self.assertEqual(d, {'1': c1})
 
-        self.failUnless(
-            getEvents(IObjectRemovedEvent,
-                      filter = lambda event: event.object == c2),
-            )
-        self.failUnless(
-            getEvents(IObjectRemovedEvent,
-                      filter = lambda event: event.object == c7)
-            )
-        self.failUnless(
-            getEvents(IObjectModifiedEvent,
-                      filter = lambda event: event.object == d)
-            )
-
     def test_configInfo(self):
 
         class V(BrowserView):
@@ -82,6 +69,9 @@
         c2 = C()
         c7 = C()
         d = Container({'1': c1, '2': c2, '7': c7})
+        c1.__parent__ = d; c1.__name__ = '1'
+        c2.__parent__ = d; c2.__name__ = '2'
+        c7.__parent__ = d; c7.__name__ = '7'
 
         view = EditRegistration(d, TestRequest())
 




More information about the Zope3-Checkins mailing list