[Zope3-checkins] CVS: Zope3/src/zope/app/services/tests -
test_servicemanager.py:1.15.2.2
Fred L. Drake, Jr.
fred at zope.com
Tue Sep 9 11:48:28 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/services/tests
In directory cvs.zope.org:/tmp/cvs-serv32322
Modified Files:
Tag: parentgeddon-branch
test_servicemanager.py
Log Message:
remove assumptions about the names that are assigned
(fixes 8 tests)
=== Zope3/src/zope/app/services/tests/test_servicemanager.py 1.15.2.1 => 1.15.2.2 ===
--- Zope3/src/zope/app/services/tests/test_servicemanager.py:1.15.2.1 Mon Sep 8 14:21:49 2003
+++ Zope3/src/zope/app/services/tests/test_servicemanager.py Tue Sep 9 10:48:28 2003
@@ -52,13 +52,16 @@
'test_service',
'/++etc++site/default/test_service1')
- default.getRegistrationManager().setObject('', registration)
- traverse(default.getRegistrationManager(), '1').status = ActiveStatus
+ rm = default.getRegistrationManager()
+ name = rm.setObject('', registration)
+ traverse(rm, name).status = ActiveStatus
testOb = getService(self.rootFolder, 'test_service')
self.assertEqual(testOb.__parent__.__parent__.__parent__,
self.rootFolder)
self.assertEqual(testOb, ts)
+ # used by one of the callers
+ return name
def test_queryLocalService(self):
sm = traverse(self.rootFolder, '++etc++site')
@@ -77,8 +80,9 @@
registration = ServiceRegistration(
'test_service',
'/++etc++site/default/test_service1')
- default.getRegistrationManager().setObject('', registration)
- traverse(default.getRegistrationManager(), '1').status = ActiveStatus
+ rm = default.getRegistrationManager()
+ name = rm.setObject('', registration)
+ traverse(rm, name).status = ActiveStatus
testOb = sm.queryLocalService('test_service')
self.assertEqual(testOb.__parent__.__parent__.__parent__,
@@ -101,17 +105,17 @@
registration = ServiceRegistration(
'test_service',
'/++etc++site/default/test_service1')
- default.getRegistrationManager().setObject('', registration)
- traverse(default.getRegistrationManager(), '1').status = ActiveStatus
+ rm = default.getRegistrationManager()
+ name = rm.setObject('', registration)
+ traverse(rm, name).status = ActiveStatus
ts2 = TestService()
default.setObject('test_service2', ts2)
registration = ServiceRegistration(
'test_service',
'/++etc++site/default/test_service2')
- default.getRegistrationManager().setObject('', registration)
- traverse(default.getRegistrationManager(), '2'
- ).status = RegisteredStatus
+ name = rm.setObject('', registration)
+ traverse(rm, name).status = RegisteredStatus
testOb = getService(self.rootFolder, 'test_service')
self.assertEqual(testOb, ts1)
@@ -123,17 +127,17 @@
gsm = getServiceManager(None)
gsm.provideService('test_service', root_ts)
- self.testGetService() # set up localservice
+ name = self.testGetService() # set up localservice
sm = traverse(self.rootFolder, '++etc++site')
cm = traverse(sm, 'default').getRegistrationManager()
- traverse(cm, '1').status = UnregisteredStatus
+ traverse(cm, name).status = UnregisteredStatus
self.assertEqual(getService(self.rootFolder, 'test_service'), root_ts)
def testContextServiceLookup(self):
self.testGetService() # set up localservice
- sm=getServiceManager(self.rootFolder)
+ sm = getServiceManager(self.rootFolder)
self.assertEqual(getService(self.folder1_1, 'test_service'),
sm['default']['test_service1'])
More information about the Zope3-Checkins
mailing list