[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/tests - testEventService.py:1.5
Jim Fulton
jim@zope.com
Thu, 3 Oct 2002 16:53:52 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/tests
In directory cvs.zope.org:/tmp/cvs-serv6678/lib/python/Zope/App/OFS/Services/LocalEventService/tests
Modified Files:
testEventService.py
Log Message:
Refactored Object events:
- All ObjectEvents now have an object attribute, which is the
the subject of the event.
- Changed the getLocation and getFromLocation methods to location and
fromLocation attributes.
Refactored HubEvents:
- Changed getObject, getRuid, and getLocation methods to object, hid,
and location attributes.
=== Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/tests/testEventService.py 1.4 => 1.5 ===
--- Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/tests/testEventService.py:1.4 Thu Sep 5 22:14:31 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/tests/testEventService.py Thu Oct 3 16:53:21 2002
@@ -137,7 +137,7 @@
"Test subscribe method with one parameter"
self._createSubscribers()
subscribe(self.rootFolderSubscriber)
- publishEvent(self.rootFolder, ObjectAddedEvent('/foo'))
+ publishEvent(self.rootFolder, ObjectAddedEvent(None, '/foo'))
self.assertEqual(self.rootFolderSubscriber.notified, 1)
def testSubscribe2(self):
@@ -147,7 +147,7 @@
self.rootFolderSubscriber,
event_type=IObjectAddedEvent
)
- publishEvent(self.folder1_1_1, ObjectAddedEvent('/foo'))
+ publishEvent(self.folder1_1_1, ObjectAddedEvent(None, '/foo'))
self.assertEqual(self.rootFolderSubscriber.notified, 1)
def testSubscribe3(self):
@@ -158,7 +158,7 @@
event_type=IObjectAddedEvent,
filter=DummyFilter()
)
- publishEvent(self.folder1_1_1, ObjectAddedEvent('/foo'))
+ publishEvent(self.folder1_1_1, ObjectAddedEvent(None, '/foo'))
self.assertEqual(self.rootFolderSubscriber.notified, 1)
def testSubscribe4(self):
@@ -171,7 +171,7 @@
event_type=IObjectAddedEvent,
filter=DummyFilter(0)
)
- publishEvent(self.folder1_1_1, ObjectAddedEvent('/foo'))
+ publishEvent(self.folder1_1_1, ObjectAddedEvent(None, '/foo'))
self.assertEqual(self.rootFolderSubscriber.notified, 0)
def testSubscribe5(self):
@@ -184,7 +184,7 @@
event_type=IObjectModifiedEvent,
filter=DummyFilter()
)
- publishEvent(self.folder1_1_1, ObjectAddedEvent('/foo'))
+ publishEvent(self.folder1_1_1, ObjectAddedEvent(None, '/foo'))
self.assertEqual(self.rootFolderSubscriber.notified, 0)
def testSubscribe6(self):
@@ -197,7 +197,7 @@
self.rootFolderSubscriber,
event_type=IObjectEvent
)
- publishEvent(self.folder1_1_1, ObjectAddedEvent('/foo'))
+ publishEvent(self.folder1_1_1, ObjectAddedEvent(None, '/foo'))
self.assertEqual(self.rootFolderSubscriber.notified, 1)
def testSubscribe7(self):
@@ -214,7 +214,7 @@
self.rootFolderSubscriber,
event_type=IObjectAddedEvent
)
- publishEvent(self.folder1_1_1, ObjectAddedEvent('/foo'))
+ publishEvent(self.folder1_1_1, ObjectAddedEvent(None, '/foo'))
self.assertEqual(self.rootFolderSubscriber.notified, 1)
def testSubscribe8(self):
@@ -235,7 +235,7 @@
event_type=IObjectAddedEvent,
filter=DummyFilter(0)
)
- publishEvent(self.folder1_1_1, ObjectAddedEvent('/foo'))
+ publishEvent(self.folder1_1_1, ObjectAddedEvent(None, '/foo'))
self.assertEqual(self.rootFolderSubscriber.notified, 2)
def testUnsubscribe1(self):
@@ -244,12 +244,12 @@
subscribe(
self.rootFolderSubscriber
)
- publishEvent(self.folder1_1_1, ObjectAddedEvent('/foo'))
+ publishEvent(self.folder1_1_1, ObjectAddedEvent(None, '/foo'))
self.assertEqual(self.rootFolderSubscriber.notified, 1)
unsubscribe(
self.rootFolderSubscriber
)
- publishEvent(self.folder1_1_1, ObjectAddedEvent('/foo'))
+ publishEvent(self.folder1_1_1, ObjectAddedEvent(None, '/foo'))
self.assertEqual(self.rootFolderSubscriber.notified, 1)
def testUnsubscribe2(self):
@@ -268,8 +268,8 @@
subscriber=self.rootFolderSubscriber
subscriber2=self.folder1Subscriber
filter=DummyFilter()
- event=ObjectAddedEvent('/foo')
- event2=ObjectModifiedEvent('/foo')
+ event=ObjectAddedEvent(None, '/foo')
+ event2=ObjectModifiedEvent(None, '/foo')
subscribe(
subscriber)
subscribe(
@@ -323,7 +323,7 @@
subscriber = self.rootFolderSubscriber
subscribe(subscriber)
self.assertEqual(subscriber.notified, 0)
- publishEvent(self.folder1_1_1, ObjectAddedEvent('/foo'))
+ publishEvent(self.folder1_1_1, ObjectAddedEvent(None, '/foo'))
self.assertEqual(subscriber.notified, 1)
def testpublishEvent2(self):
@@ -342,7 +342,7 @@
subscriber,
event_type=IObjectAddedEvent,
)
- publishEvent(self.folder1_1_1, ObjectAddedEvent('/foo'))
+ publishEvent(self.folder1_1_1, ObjectAddedEvent(None, '/foo'))
self.assertEqual(subscriber.notified, 2)
def testpublishEvent3(self):
@@ -410,7 +410,7 @@
"""test to see if events are not passed on to a parent event
service with the appropriate isPromotableEvent setting"""
self._createAlternateService(UnpromotingLocalEventService())
- publishEvent(self.folder2, ObjectAddedEvent('/foo'))
+ publishEvent(self.folder2, ObjectAddedEvent(None, '/foo'))
self.assertEqual(self.folder2Subscriber.notified, 1)
self.assertEqual(self.rootFolderSubscriber.notified, 0)
@@ -418,7 +418,7 @@
"""test to see if events are passed on to a parent event
service with the appropriate isPromotableEvent setting"""
self._createAlternateService(LocalEventService())
- publishEvent(self.folder2, ObjectAddedEvent('/foo'))
+ publishEvent(self.folder2, ObjectAddedEvent(None, '/foo'))
self.assertEqual(self.folder2Subscriber.notified, 1)
self.assertEqual(self.rootFolderSubscriber.notified, 1)
@@ -442,7 +442,7 @@
sm=getServiceManager(self.folder1)
directive = sm.getDirectives("Events")[0]
sm.unbindService(directive)
- publishEvent(self.rootFolder, ObjectAddedEvent('/foo'))
+ publishEvent(self.rootFolder, ObjectAddedEvent(None, '/foo'))
self.assertEqual(self.folder1Subscriber.notified, 0)
self.assertEqual(self.folder1_1Subscriber.notified, 1)
@@ -452,7 +452,7 @@
sv=LocalEventService()
sv.subscribeOnBind=0
self._createAlternateService(sv)
- publishEvent(self.rootFolder, ObjectAddedEvent('/foo'))
+ publishEvent(self.rootFolder, ObjectAddedEvent(None, '/foo'))
self.assertEqual(self.folder2Subscriber.notified, 0)
self.assertEqual(self.rootFolderSubscriber.notified, 1)
sm=getServiceManager(self.folder2)