[Zope3-checkins] CVS: Zope3/src/zope/app/registration/tests -
test_registrationstatusproperty.py:1.2
Jim Fulton
jim at zope.com
Thu Apr 8 17:02:45 EDT 2004
Update of /cvs-repository/Zope3/src/zope/app/registration/tests
In directory cvs.zope.org:/tmp/cvs-serv12553/src/zope/app/registration/tests
Modified Files:
test_registrationstatusproperty.py
Log Message:
Change to make assertions in terms of info(), rather than the private
_data attr that doesn't exist any more.
Fixed a bug in the unregistration logic. If we have something active,
then make something else active and then unregister the something
else, the original thing that was active should be active again.
=== Zope3/src/zope/app/registration/tests/test_registrationstatusproperty.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/registration/tests/test_registrationstatusproperty.py:1.1 Sat Mar 13 13:01:18 2004
+++ Zope3/src/zope/app/registration/tests/test_registrationstatusproperty.py Thu Apr 8 17:02:45 2004
@@ -39,8 +39,6 @@
class UtilityRegistration(TestingRegistration):
serviceType = "Utilities"
-class TestingRegistrationStack(TestingRegistrationStack):
- class_ = TestingRegistration
class TestingServiceManager:
@@ -90,38 +88,53 @@
self.assertEqual(configa.status, UnregisteredStatus)
configa.status = RegisteredStatus
- self.assertEqual(self.__sm.registry._data, (None, 'a'))
+
+ data = [(int(info['active']), info['registration'].id)
+ for info in self.__sm.registry.info()]
+ self.assertEqual(data, [(0, 'a')])
self.assertEqual(configa.status, RegisteredStatus)
configa.status = ActiveStatus
- self.assertEqual(self.__sm.registry._data, ('a', ))
+ data = [(info['active'], info['registration'].id)
+ for info in self.__sm.registry.info()]
+ self.assertEqual(data, [(1, 'a')])
self.assertEqual(configa.status, ActiveStatus)
configb = contained(TestingRegistration('b'), self.rootFolder)
- self.assertEqual(self.__sm.registry._data, ('a', ))
+ data = [(info['active'], info['registration'].id)
+ for info in self.__sm.registry.info()]
+ self.assertEqual(data, [(1, 'a',)])
self.assertEqual(configb.status, UnregisteredStatus)
configb.status = RegisteredStatus
- self.assertEqual(self.__sm.registry._data, ('a', 'b'))
+ data = [(info['active'], info['registration'].id)
+ for info in self.__sm.registry.info()]
+ self.assertEqual(data, [(1, 'a'), (0, 'b')])
self.assertEqual(configb.status, RegisteredStatus)
configc = contained(TestingRegistration('c'), self.rootFolder)
self.assertEqual(configc.status, UnregisteredStatus)
- self.assertEqual(self.__sm.registry._data, ('a', 'b'))
+ self.assertEqual(data, [(1, 'a'), (0, 'b')])
configc.status = RegisteredStatus
- self.assertEqual(self.__sm.registry._data, ('a', 'b', 'c'))
+ data = [(info['active'], info['registration'].id)
+ for info in self.__sm.registry.info()]
+ self.assertEqual(data, [(1, 'a'), (0, 'b'), (0, 'c')])
self.assertEqual(configc.status, RegisteredStatus)
configc.status = ActiveStatus
- self.assertEqual(self.__sm.registry._data, ('c', 'a', 'b'))
+ data = [(info['active'], info['registration'].id)
+ for info in self.__sm.registry.info()]
+ self.assertEqual(data, [(1, 'c'), (0, 'a'), (0, 'b')])
self.assertEqual(configc.status, ActiveStatus)
configc.status = UnregisteredStatus
- self.assertEqual(self.__sm.registry._data, (None, 'a', 'b'))
+ data = [(int(info['active']), info['registration'].id)
+ for info in self.__sm.registry.info()]
+ self.assertEqual(data, [(1, 'a'), (0, 'b')])
self.assertEqual(configc.status, UnregisteredStatus)
self.assertEqual(configb.status, RegisteredStatus)
- self.assertEqual(configa.status, RegisteredStatus)
+ self.assertEqual(configa.status, ActiveStatus)
def test_passive(self):
# scenario:
More information about the Zope3-Checkins
mailing list