[Zope3-checkins] CVS: Zope3/src/zope/app/services/tests - test_registrationstack.py:1.4

Jim Fulton cvs-admin at zope.org
Fri Nov 21 12:09:57 EST 2003


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

Modified Files:
	test_registrationstack.py 
Log Message:
Fixed bugs in activation and deactivation notification.
Registrations were being notified too soon.


=== Zope3/src/zope/app/services/tests/test_registrationstack.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/services/tests/test_registrationstack.py:1.3	Sun Sep 21 13:33:24 2003
+++ Zope3/src/zope/app/services/tests/test_registrationstack.py	Fri Nov 21 12:09:56 2003
@@ -26,11 +26,17 @@
 class Registration:
 
     active = 0
+    registry = None
 
     def activated(self):
+        if (self.registry is not None) and (self.registry.active() != self):
+            raise AssertionError("Told active but not the active registration")
         self.active += 1
 
     def deactivated(self):
+        if (self.registry is not None) and (self.registry.active() == self):
+            raise AssertionError(
+                "Told deactivated but still the active registration")
         self.active -= 1
 
 
@@ -53,6 +59,7 @@
 
         self.failIf(registry)
         self.__c1 = c1 = self.__config("1")
+        c1.registry = registry
         registry.register(c1)
         self.failUnless(registry)
         self.failUnless(registry.registered(c1))
@@ -61,6 +68,7 @@
         self.assertEqual(registry.active(), None)
 
         self.__c2 = c2 = self.__config("2")
+        c2.registry = registry
         self.failIf(registry.registered(c2))
         registry.register(c2)
         self.failUnless(registry)




More information about the Zope3-Checkins mailing list