[Zope-CVS] CVS: Packages/pypes/pypes/tests - test_event.py:1.4 test_identity.py:1.5

Casey Duncan casey at zope.com
Sun Feb 8 22:56:23 EST 2004


Update of /cvs-repository/Packages/pypes/pypes/tests
In directory cvs.zope.org:/tmp/cvs-serv4474/tests

Modified Files:
	test_event.py test_identity.py 
Log Message:
Add extent map interface
Move identity message from event module to identity
Add listenForIdEvents helper function and test


=== Packages/pypes/pypes/tests/test_event.py 1.3 => 1.4 ===
--- Packages/pypes/pypes/tests/test_event.py:1.3	Fri Jan 30 00:35:39 2004
+++ Packages/pypes/pypes/tests/test_event.py	Sun Feb  8 22:56:22 2004
@@ -313,7 +313,7 @@
 class TestMessages(unittest.TestCase):
     
     def testIdRegistered(self):
-        from pypes.event import IdRegisteredMessage
+        from pypes.identity import IdRegisteredMessage
         from pypes.interfaces import IIdentityMessage
         ob = TestListener()
         msg = IdRegisteredMessage(ob, 'blah')
@@ -322,7 +322,7 @@
         self.assertEqual(msg.id, 'blah')
     
     def testIdUnregistered(self):
-        from pypes.event import IdUnregisteredMessage
+        from pypes.identity import IdUnregisteredMessage
         from pypes.interfaces import IIdentityMessage
         ob = TestListener()
         msg = IdUnregisteredMessage(ob, 'blah')


=== Packages/pypes/pypes/tests/test_identity.py 1.4 => 1.5 ===
--- Packages/pypes/pypes/tests/test_identity.py:1.4	Fri Jan 30 00:35:39 2004
+++ Packages/pypes/pypes/tests/test_identity.py	Sun Feb  8 22:56:22 2004
@@ -214,8 +214,7 @@
     
     def testIdRegisteredEvent(self):
         from pypes import services
-        from pypes.identity import pypesid
-        from pypes.event import IdRegisteredMessage
+        from pypes.identity import pypesid, IdRegisteredMessage
         event = services.event(self.conn)
         tl = TestListener()
         event.registerListener(tl, 'receive', IdRegisteredMessage)
@@ -226,7 +225,7 @@
 
     def testIdRegisteredEventMultiple(self):
         from pypes import services
-        from pypes.event import IdRegisteredMessage
+        from pypes.identity import IdRegisteredMessage
         event = services.event(self.conn)
         tl = TestListener()
         event.registerListener(tl, 'receive', IdRegisteredMessage)
@@ -238,8 +237,7 @@
     
     def testIdUnregisteredEvent(self):
         from pypes import services
-        from pypes.identity import pypesid
-        from pypes.event import IdUnregisteredMessage
+        from pypes.identity import pypesid, IdUnregisteredMessage
         event = services.event(self.conn)
         tl = TestListener()
         event.registerListener(tl, 'receive', IdUnregisteredMessage)
@@ -253,7 +251,7 @@
 
     def testIdUnregisteredEventMultiple(self):
         from pypes import services
-        from pypes.event import IdUnregisteredMessage
+        from pypes.identity import IdUnregisteredMessage
         event = services.event(self.conn)
         tl = TestListener()
         event.registerListener(tl, 'receive', IdUnregisteredMessage)
@@ -262,6 +260,23 @@
         for o in objs:
             self.identity.remove(o)
         self.assertEqual(len(tl.received), 10)
+    
+    def testListenForIdEventsFunc(self):
+        from pypes import services
+        from pypes.identity import listenForIdEvents
+        from pypes.identity import IdRegisteredMessage, IdUnregisteredMessage
+        event = services.event(self.conn)
+        tl = TestListener()
+        listenForIdEvents(tl, self.conn, 'receive', 'receive')
+        self.assertEqual(len(tl.received), 0)
+        obj = self._newObj()
+        self.assertEqual(len(tl.received), 1)
+        self.identity.remove(obj)
+        msg1, msg2 = tl.received        
+        self.failUnless(msg1.object is obj)
+        self.failUnless(isinstance(msg1, IdRegisteredMessage))
+        self.failUnless(msg2.object is obj)
+        self.failUnless(isinstance(msg2, IdUnregisteredMessage))
         
 class TestIdentityServicePersistence(PersistenceTest):
     




More information about the Zope-CVS mailing list