[Zope3-checkins] CVS: Zope3/src/zope/app/event/tests - test_directives.py:1.10.10.2 test_eventpublisher.py:1.4.24.2 test_logger.py:1.10.18.2 test_objectevent.py:1.3.52.2

Jim Fulton jim at zope.com
Mon Sep 15 14:13:02 EDT 2003


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

Modified Files:
      Tag: parentgeddon-branch
	test_directives.py test_eventpublisher.py test_logger.py 
	test_objectevent.py 
Log Message:
Got lots of tests to pass.

Added a setitem helper function to be used to help satisfy container
contracts.



=== Zope3/src/zope/app/event/tests/test_directives.py 1.10.10.1 => 1.10.10.2 ===
--- Zope3/src/zope/app/event/tests/test_directives.py:1.10.10.1	Fri Sep 12 15:15:24 2003
+++ Zope3/src/zope/app/event/tests/test_directives.py	Mon Sep 15 14:12:31 2003
@@ -62,11 +62,12 @@
             </configure>'''
             ))
 
-        publish(None, ObjectAddedEvent(None, None, 'foo'))
+        parent= object()
+        publish(None, ObjectAddedEvent(None, parent, 'foo'))
         self.assertEqual(subscriber.notified, 1)
-        publish(None, ObjectRemovedEvent(object(), None, 'foo'))
+        publish(None, ObjectRemovedEvent(object(), parent, 'foo'))
         self.assertEqual(subscriber.notified, 2)
-        publish(None, ObjectModifiedEvent(None, 'foo'))
+        publish(None, ObjectModifiedEvent(None))
         self.assertEqual(subscriber.notified, 2) # NB: no increase ;-)
         publish(None, DummyEvent())
         self.assertEqual(subscriber.notified, 4) # NB: increased by 2 ;-)


=== Zope3/src/zope/app/event/tests/test_eventpublisher.py 1.4.24.1 => 1.4.24.2 ===
--- Zope3/src/zope/app/event/tests/test_eventpublisher.py:1.4.24.1	Fri Sep 12 15:15:24 2003
+++ Zope3/src/zope/app/event/tests/test_eventpublisher.py	Mon Sep 15 14:12:31 2003
@@ -46,7 +46,8 @@
     def setUp(self):
         PlacelessSetup.setUp(self)
         self.service = GlobalEventPublisher()
-        self.event = ObjectAddedEvent(None, None, 'foo')
+        parent = object()
+        self.event = ObjectAddedEvent(None, parent, 'foo')
         self.subscriber = DummySubscriber()
 
     def testSubscribe1(self):
@@ -164,7 +165,7 @@
         # Test selective unsubscribe
         subscriber2=DummySubscriber()
         filter=DummyFilter()
-        event2=ObjectModifiedEvent(None, '/foo')
+        event2=ObjectModifiedEvent(None)
         self.service.globalSubscribe(
             self.subscriber)
         self.service.globalSubscribe(


=== Zope3/src/zope/app/event/tests/test_logger.py 1.10.18.1 => 1.10.18.2 ===
--- Zope3/src/zope/app/event/tests/test_logger.py:1.10.18.1	Fri Sep 12 15:15:24 2003
+++ Zope3/src/zope/app/event/tests/test_logger.py	Mon Sep 15 14:12:31 2003
@@ -56,7 +56,7 @@
         # register a logger
         globalSubscribe(self.eventlogger)
         # send an event
-        publish(None, ObjectAddedEvent(None, 'foo'))
+        publish(None, ObjectAddedEvent(None, "parent", 'foo'))
 
     def tearDown(self):
         globalUnsubscribe(self.eventlogger)
@@ -72,10 +72,16 @@
         result = results[0]
         self.assertEqual(result.name, "Event.Logger")
         self.assertEqual(result.levelno, logging.INFO)
-        self.assertEqual(result.getMessage(),
-                         "zope.app.container.contained.ObjectAddedEvent: "
-                         "[('_ObjectEvent__location', 'foo'), "
-                         "('object', None)]\n")
+        self.assertEqual(
+            result.getMessage(),
+            "zope.app.container.contained.ObjectAddedEvent: ["
+            "('newName', 'foo'),\n "
+            "('newParent', 'parent'),\n "
+            "('object', None),\n "
+            "('oldName', None),\n "
+            "('oldParent', None)"
+            "]\n"
+            )
         self.assertEqual(result.exc_info, None)
 
 class TestLogger2(TestLogger1):
@@ -89,10 +95,16 @@
         result = results[0]
         self.assertEqual(result.name, "Event.Logger")
         self.assertEqual(result.levelno, logging.CRITICAL)
-        self.assertEqual(result.getMessage(),
-                         "zope.app.container.contained.ObjectAddedEvent: "
-                         "[('_ObjectEvent__location', 'foo'), "
-                         "('object', None)]\n")
+        self.assertEqual(
+            result.getMessage(),
+            "zope.app.container.contained.ObjectAddedEvent: ["
+            "('newName', 'foo'),\n "
+            "('newParent', 'parent'),\n "
+            "('object', None),\n "
+            "('oldName', None),\n "
+            "('oldParent', None)"
+            "]\n"
+            )
         self.assertEqual(result.exc_info, None)
 
 def test_suite():


=== Zope3/src/zope/app/event/tests/test_objectevent.py 1.3.52.1 => 1.3.52.2 ===
--- Zope3/src/zope/app/event/tests/test_objectevent.py:1.3.52.1	Fri Sep 12 15:15:24 2003
+++ Zope3/src/zope/app/event/tests/test_objectevent.py	Mon Sep 15 14:12:31 2003
@@ -27,14 +27,10 @@
 
     klass = ObjectModifiedEvent
 
-    location = '/some/location'
     object = object()
 
     def setUp(self):
-        self.event = self.klass(self.object, self.location)
-
-    def testGetLocation(self):
-        self.assertEqual(self.event.location, self.location)
+        self.event = self.klass(self.object)
 
     def testGetObject(self):
         self.assertEqual(self.event.object, self.object)




More information about the Zope3-Checkins mailing list