[Zope3-checkins] CVS: Zope3/src/zope/app/services/tests - registrationstack.py:1.2 test_registrations.py:1.2 test_registrationstatusproperty.py:1.2

Jim Fulton jim@zope.com
Sun, 22 Jun 2003 20:32:02 -0400


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

Modified Files:
	registrationstack.py test_registrations.py 
	test_registrationstatusproperty.py 
Log Message:
Now that RegistrationStatusProperty gets the serviceType from the
registration, we can have one definition of status in the base class, 
SimpleRegistration.


=== Zope3/src/zope/app/services/tests/registrationstack.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/services/tests/registrationstack.py:1.1	Sat Jun 21 17:22:13 2003
+++ Zope3/src/zope/app/services/tests/registrationstack.py	Sun Jun 22 20:31:31 2003
@@ -12,9 +12,13 @@
 #
 ##############################################################################
 
+from zope.app.services.registration import RegistrationStatusProperty
+
 __metaclass__ = type
 
 class TestingRegistration:
+    status = RegistrationStatusProperty()
+
     def __init__(self, id):
         self.id = id
 


=== Zope3/src/zope/app/services/tests/test_registrations.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/services/tests/test_registrations.py:1.1	Sat Jun 21 17:22:13 2003
+++ Zope3/src/zope/app/services/tests/test_registrations.py	Sun Jun 22 20:31:31 2003
@@ -59,6 +59,16 @@
 
 class TestSimpleRegistration(TestCase):
 
+    def setUp(self):
+        # We can't use the status property on a SimpleRegistration instance.
+        # we disable it for these tests
+        self.__oldprop = SimpleRegistration.status
+        del SimpleRegistration.status
+
+    def tearDown(self):
+        # Restore the status prop
+        SimpleRegistration.status = self.__oldprop
+
     def test_beforeDeleteHook(self):
         container = object()
         cfg = SimpleRegistration()
@@ -78,6 +88,7 @@
 class TestComponentRegistration(TestSimpleRegistration, PlacefulSetup):
 
     def setUp(self):
+        TestSimpleRegistration.setUp(self)
         PlacefulSetup.setUp(self, site=True)
         self.name = 'foo'
 


=== Zope3/src/zope/app/services/tests/test_registrationstatusproperty.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/services/tests/test_registrationstatusproperty.py:1.1	Sat Jun 21 17:22:13 2003
+++ Zope3/src/zope/app/services/tests/test_registrationstatusproperty.py	Sun Jun 22 20:31:31 2003
@@ -23,7 +23,6 @@
 from zope.app.services.tests.placefulsetup import PlacefulSetup
 from zope.app.services.tests.registrationstack import TestingRegistration
 from zope.app.services.tests.registrationstack import TestingRegistrationStack
-from zope.app.services.registration import RegistrationStatusProperty
 from zope.app.interfaces.services.registration import RegisteredStatus
 from zope.app.interfaces.services.registration import UnregisteredStatus
 from zope.app.interfaces.services.registration import ActiveStatus
@@ -35,16 +34,13 @@
 
 class TestingRegistration(TestingRegistration):
     serviceType = "Services"
-    status = RegistrationStatusProperty()
     service_type = "Test"
 
 class PassiveRegistration(TestingRegistration):
     serviceType = "NoSuchService"
-    status = RegistrationStatusProperty()
 
 class UtilityRegistration(TestingRegistration):
     serviceType = "Utilities"
-    status = RegistrationStatusProperty()
 
 class TestingRegistrationStack(TestingRegistrationStack):
     class_ = TestingRegistration