[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/tests - testConfigurationManager.py:1.1.2.1 testServiceConfiguration.py:1.1.2.1 PlacefulSetup.py:1.6.4.1 testServiceManager.py:1.3.6.2 TestingServiceManager.py:NONE testConfiguration.py:NONE testServiceDirective.py:NONE
Jim Fulton
jim@zope.com
Sat, 30 Nov 2002 07:45:01 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/tests
In directory cvs.zope.org:/tmp/cvs-serv30047/lib/python/Zope/App/OFS/Services/ServiceManager/tests
Modified Files:
Tag: Zope3-Bangalore-TTW-Branch
PlacefulSetup.py testServiceManager.py
Added Files:
Tag: Zope3-Bangalore-TTW-Branch
testConfigurationManager.py testServiceConfiguration.py
Removed Files:
Tag: Zope3-Bangalore-TTW-Branch
TestingServiceManager.py testConfiguration.py
testServiceDirective.py
Log Message:
Refactored the way TTW component registration is done. There are now
separate registry objects that abstract the machinery for registering
multiple conflicting configurations and deciding which, if any are
active. Also provided a new field and widget for the status
information.
Along the way, cleaned up and streamlined placeful testing
infrastructure a bit.
Now checking into branch. Will give file-by-file (or at least more
specific logs) when the changes are merged into the head.
=== Added File Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/tests/testConfigurationManager.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""
$Id: testConfigurationManager.py,v 1.1.2.1 2002/11/30 12:44:31 jim Exp $
"""
from Zope.App.OFS.Services.ServiceManager.ConfigurationManager \
import ConfigurationManager
from Zope.App.OFS.Services.ServiceManager.IConfigurationManager \
import IConfigurationManager
from unittest import TestCase, TestSuite, main, makeSuite
from Interface.Common.tests.BaseTestMapping import BaseTestIEnumerableMapping
from Interface.Verify import verifyObject
class Test(BaseTestIEnumerableMapping, TestCase):
"""Testing for Configuration Manager """
def setUp(self):
self.__manager = manager = ConfigurationManager()
for l in 'abcdefghijklmnop':
manager.setObject('', l)
del manager['8']
del manager['10']
def test_implements_IConfigurationManager(self):
verifyObject(IConfigurationManager, self.__manager)
def _IEnumerableMapping__stateDict(self):
# Hook needed by BaseTestIEnumerableMapping
# also, effectively test setObject and __delitem__.
return {
'1': 'a', '2': 'b', '3': 'c', '4': 'd', '5': 'e',
'6': 'f', '7': 'g', '9': 'i', '11': 'k', '12': 'l',
'13': 'm', '14': 'n', '15': 'o', '16': 'p',
}
def _IEnumerableMapping__sample(self):
# Hook needed by BaseTestIEnumerableMapping
# also, effectively test setObject and __delitem__.
return self.__manager
def _IEnumerableMapping__absentKeys(self):
# Hook needed by BaseTestIEnumerableMapping
# also, effectively test setObject and __delitem__.
return ['-1', '8', '10', '17', '100', '10000']
#########################################################
# Move Top
def test_moveTop_nothing(self):
self.__manager.moveTop([])
self.assertEqual(
list(self.__manager.keys()),
['1', '2', '3', '4', '5', '6', '7', '9',
'11', '12', '13', '14', '15', '16'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveTop_1_no_effect(self):
self.__manager.moveTop(['1'])
self.assertEqual(
list(self.__manager.keys()),
['1', '2', '3', '4', '5', '6', '7', '9',
'11', '12', '13', '14', '15', '16'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveTop_many_no_effect(self):
self.__manager.moveTop(['1', '88', '3', '2', '99'])
self.assertEqual(
list(self.__manager.keys()),
['1', '2', '3', '4', '5', '6', '7', '9',
'11', '12', '13', '14', '15', '16'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveTop_1(self):
self.__manager.moveTop(['3'])
self.assertEqual(
list(self.__manager.keys()),
['3', '1', '2', '4', '5', '6', '7', '9',
'11', '12', '13', '14', '15', '16'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveTop_many(self):
self.__manager.moveTop(['1', '3', '88', '4', '11', '15', '16', '99'])
self.assertEqual(
list(self.__manager.keys()),
['1', '3', '4', '11', '15', '16', '2', '5', '6', '7', '9',
'12', '13', '14'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveTop_one_element_container(self):
manager = ConfigurationManager()
manager.setObject('', 'a')
manager.moveTop(['1'])
self.assertEqual(list(manager.items()), [('1', 'a')])
#########################################################
# Move Bottom
def test_moveBottom_nothing(self):
self.__manager.moveBottom([])
self.assertEqual(
list(self.__manager.keys()),
['1', '2', '3', '4', '5', '6', '7', '9',
'11', '12', '13', '14', '15', '16'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveBottom_1_no_effect(self):
self.__manager.moveBottom(['16'])
self.assertEqual(
list(self.__manager.keys()),
['1', '2', '3', '4', '5', '6', '7', '9',
'11', '12', '13', '14', '15', '16'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveBottom_many_no_effect(self):
self.__manager.moveBottom(['14', '88', '16', '15', '99'])
self.assertEqual(
list(self.__manager.keys()),
['1', '2', '3', '4', '5', '6', '7', '9',
'11', '12', '13', '14', '15', '16'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveBottom_1(self):
self.__manager.moveBottom(['3'])
self.assertEqual(
list(self.__manager.keys()),
['1', '2', '4', '5', '6', '7', '9',
'11', '12', '13', '14', '15', '16', '3'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveBottom_many(self):
self.__manager.moveBottom(
['1', '3', '88', '4', '11', '16', '15', '99'])
self.assertEqual(
list(self.__manager.keys()),
['2', '5', '6', '7', '9',
'12', '13', '14', '1', '3', '4', '11', '15', '16'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveBottom_one_element_container(self):
manager = ConfigurationManager()
manager.setObject('', 'a')
manager.moveBottom(['1'])
self.assertEqual(list(manager.items()), [('1', 'a')])
#########################################################
# Move Up
def test_moveUp_nothing(self):
self.__manager.moveUp([])
self.assertEqual(
list(self.__manager.keys()),
['1', '2', '3', '4', '5', '6', '7', '9',
'11', '12', '13', '14', '15', '16'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveUp_1_no_effect(self):
self.__manager.moveUp(['1'])
self.assertEqual(
list(self.__manager.keys()),
['1', '2', '3', '4', '5', '6', '7', '9',
'11', '12', '13', '14', '15', '16'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveUp_many_no_effect(self):
self.__manager.moveUp(['1', '88', '3', '2', '99'])
self.assertEqual(
list(self.__manager.keys()),
['1', '2', '3', '4', '5', '6', '7', '9',
'11', '12', '13', '14', '15', '16'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveUp_1(self):
self.__manager.moveUp(['3'])
self.assertEqual(
list(self.__manager.keys()),
['1', '3', '2', '4', '5', '6', '7', '9',
'11', '12', '13', '14', '15', '16'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveUp_many(self):
self.__manager.moveUp(
['1', '3', '88', '4', '11', '16', '15', '99'])
self.assertEqual(
list(self.__manager.keys()),
['1', '3', '4', '2', '5', '6', '7', '11', '9',
'12', '13', '15', '16', '14'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveUp_one_element_container(self):
manager = ConfigurationManager()
manager.setObject('', 'a')
manager.moveUp(['1'])
self.assertEqual(list(manager.items()), [('1', 'a')])
#########################################################
# Move Down
def test_moveDown_nothing(self):
self.__manager.moveDown([])
self.assertEqual(
list(self.__manager.keys()),
['1', '2', '3', '4', '5', '6', '7', '9',
'11', '12', '13', '14', '15', '16'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveDown_1_no_effect(self):
self.__manager.moveDown(['16'])
self.assertEqual(
list(self.__manager.keys()),
['1', '2', '3', '4', '5', '6', '7', '9',
'11', '12', '13', '14', '15', '16'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveDown_many_no_effect(self):
self.__manager.moveDown(['16', '88', '14', '15', '99'])
self.assertEqual(
list(self.__manager.keys()),
['1', '2', '3', '4', '5', '6', '7', '9',
'11', '12', '13', '14', '15', '16'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveDown_1(self):
self.__manager.moveDown(['3'])
self.assertEqual(
list(self.__manager.keys()),
['1', '2', '4', '3', '5', '6', '7', '9',
'11', '12', '13', '14', '15', '16'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveDown_many(self):
self.__manager.moveDown(
['1', '3', '88', '4', '11', '16', '15', '99'])
self.assertEqual(
list(self.__manager.keys()),
['2', '1', '5', '3', '4', '6', '7', '9',
'12', '11', '13', '14', '15', '16'],
)
# Make sure we still have thye right items
self.test_items()
def test_moveDown_one_element_container(self):
manager = ConfigurationManager()
manager.setObject('', 'a')
manager.moveDown(['1'])
self.assertEqual(list(manager.items()), [('1', 'a')])
def test_suite():
return makeSuite(Test)
if __name__=='__main__':
main(defaultTest='test_suite')
=== Added File Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/tests/testServiceConfiguration.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""XXX short summary goes here.
XXX longer description goes here.
$Id: testServiceConfiguration.py,v 1.1.2.1 2002/11/30 12:44:31 jim Exp $
"""
from unittest import TestCase, TestSuite, main, makeSuite
from Interface import Interface
from Zope.ComponentArchitecture import getServiceManager
from Zope.App.Traversing import traverse
from Zope.App.OFS.Services.ServiceManager.ServiceConfiguration \
import ServiceConfiguration
from Zope.App.OFS.Services.ServiceManager.tests.PlacefulSetup \
import PlacefulSetup
from Zope.App.OFS.Services.ServiceManager.ServiceManager \
import ServiceManager
from Zope.ComponentArchitecture.GlobalServiceManager \
import serviceManager
from Zope.App.OFS.Services.ServiceManager.IBindingAware \
import IBindingAware
from Zope.App.OFS.Services.ConfigurationInterfaces \
import Active, Unregistered, Registered
from Zope.App.DependencyFramework.IDependable import IDependable
from Zope.App.DependencyFramework.Exceptions import DependencyError
from Zope.App.OFS.Container.ZopeContainerAdapter import ZopeContainerAdapter
class ITestService(Interface):
pass
class TestService:
__implements__ = ITestService, IBindingAware, IDependable
_bound = _unbound = ()
def bound(self, name):
self._bound += (name, )
def unbound(self, name):
self._unbound += (name, )
_dependents = ()
def addDependent(self, location):
self._dependents = tuple(
[d for d in self._dependents if d != location]
+
[location]
)
def removeDependent(self, location):
self._dependents = tuple(
[d for d in self._dependents if d != location]
)
def dependents(self):
return self._dependents
class Test(PlacefulSetup, TestCase):
def setUp(self):
PlacefulSetup.setUp(self)
self.buildFolders()
self.rootFolder.setServiceManager(ServiceManager())
serviceManager.defineService('test_service', ITestService)
default = traverse(self.rootFolder,
'++etc++Services/Packages/default')
self.__default = default
default.setObject('c', TestService())
configuration = ServiceConfiguration(
'test_service', '/++etc++Services/Packages/default/c')
self.__c = traverse(default, 'c')
self.__cm = ZopeContainerAdapter(traverse(default, "configure"))
self.__cm.setObject('', configuration)
self.__config = traverse(default, 'configure/1')
def test_getService(self):
self.assertEqual(self.__config.getService(), self.__c)
def test_activated(self):
old = self.__c._bound
self.__config.activated()
self.assertEqual(self.__c._bound, old+('test_service',))
def test_deactivated(self):
old = self.__c._unbound
self.__config.deactivated()
self.assertEqual(self.__c._unbound, old+('test_service',))
def test_manage_afterAdd(self):
self.assertEqual(self.__c._dependents,
('/++etc++Services/Packages/default/configure/1', ))
def test_manage_beforeDelete_and_unregistered(self):
self.__config.status = Registered
sm = getServiceManager(self.__default)
registry = sm.queryConfigurationsFor(self.__config)
self.failUnless(registry, "The components should be registered")
del self.__cm['1']
self.assertEqual(self.__c._dependents, ())
self.failIf(registry, "The components should not be registered")
def test_disallow_delete_when_active(self):
self.__config.status = Active
try:
del self.__cm['1']
except DependencyError:
pass # OK
else:
self.failUnless(0, "Should have gotten a depency error")
def test_suite():
return makeSuite(Test)
if __name__=='__main__':
main(defaultTest='test_suite')
=== Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/tests/PlacefulSetup.py 1.6 => 1.6.4.1 ===
--- Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/tests/PlacefulSetup.py:1.6 Fri Oct 4 14:37:22 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/tests/PlacefulSetup.py Sat Nov 30 07:44:30 2002
@@ -17,24 +17,65 @@
$Id$
"""
from Zope.App.tests.PlacelessSetup import PlacelessSetup
+from Zope import ComponentArchitecture as CA
+from Zope.App.ComponentArchitecture import hooks
+from Zope.ComponentArchitecture.GlobalAdapterService import provideAdapter
+
+from Zope.App.Traversing import getPhysicalPathString
+from Zope.App.Traversing.DefaultTraversable import DefaultTraversable
+from Zope.App.Traversing.EtcNamespace import etc
+from Zope.App.Traversing.IContainmentRoot import IContainmentRoot
+from Zope.App.Traversing.IPhysicallyLocatable import IPhysicallyLocatable
+from Zope.App.Traversing.ITraverser import ITraverser
+from Zope.App.Traversing.ITraversable import ITraversable
+from Zope.App.Traversing.Namespaces import provideNamespaceHandler
+from Zope.App.Traversing.PhysicalLocationAdapters \
+ import WrapperPhysicallyLocatable, RootPhysicallyLocatable
+from Zope.App.Traversing.Traverser import Traverser
+
+from Zope.App.OFS.Content.Folder.RootFolder import IRootFolder
+
+
+from Zope.App.OFS.Container.IContainer import ISimpleReadContainer
+from Zope.App.OFS.Container.ContainerTraversable import ContainerTraversable
+
+from Zope.ComponentArchitecture.GlobalViewService import provideView
+from Zope.Publisher.Browser.IBrowserPresentation import IBrowserPresentation
+from Zope.App.ZopePublication.TraversalViews.AbsoluteURL \
+ import SiteAbsoluteURL, AbsoluteURL
class PlacefulSetup(PlacelessSetup):
def setUp(self):
PlacelessSetup.setUp(self)
- # set up etc namespace
- from Zope.App.Traversing.Namespaces import provideNamespaceHandler
- from Zope.App.Traversing.EtcNamespace import etc
- provideNamespaceHandler("etc", etc)
# set up placeful hooks, saving originals for tearDown
- from Zope import ComponentArchitecture as CA
self.__old_getServiceManager_hook = CA.getServiceManager_hook
- from Zope.App.ComponentArchitecture import hooks
CA.getServiceManager_hook = hooks.getServiceManager_hook
+ self.setUpTraversal()
+
+ def setUpTraversal(self):
+
+ provideAdapter(None, ITraverser, Traverser)
+ provideAdapter(None, ITraversable, DefaultTraversable)
+
+ provideAdapter(
+ ISimpleReadContainer, ITraversable, ContainerTraversable)
+ provideAdapter(
+ None, IPhysicallyLocatable, WrapperPhysicallyLocatable)
+ provideAdapter(
+ IContainmentRoot, IPhysicallyLocatable, RootPhysicallyLocatable)
+
+ # set up etc namespace
+ provideNamespaceHandler("etc", etc)
+
+ provideView(None, "absolute_url", IBrowserPresentation,
+ AbsoluteURL)
+ provideView(IRootFolder, "absolute_url", IBrowserPresentation,
+ SiteAbsoluteURL)
+
def tearDown(self):
# clean up folders and placeful service managers and services too?
- from Zope import ComponentArchitecture as CA
CA.getServiceManager_hook = self.__old_getServiceManager_hook
PlacelessSetup.tearDown(self)
@@ -94,8 +135,10 @@
name = "folder2_1_1")
def createServiceManager(self, folder = None):
- if folder is None: folder = self.rootFolder
- from Zope.App.OFS.Services.ServiceManager.ServiceManager \
- import ServiceManager
- folder.setServiceManager(ServiceManager())
+ if folder is None:
+ folder = self.rootFolder
+ from Zope.App.OFS.Services.tests.TestingServiceManager \
+ import TestingServiceManager
+
+ folder.setServiceManager(TestingServiceManager())
=== Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/tests/testServiceManager.py 1.3.6.1 => 1.3.6.2 ===
--- Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/tests/testServiceManager.py:1.3.6.1 Thu Oct 17 13:02:44 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/tests/testServiceManager.py Sat Nov 30 07:44:31 2002
@@ -23,18 +23,19 @@
from Zope.App.OFS.Content.Folder.Folder import Folder
from Zope.Proxy.ContextWrapper import getWrapperContext, getWrapperContainer
from Zope.App.OFS.Services.ServiceManager.ServiceManager import ServiceManager
-from Zope.App.OFS.Services.ServiceManager.ServiceDirective \
- import ServiceDirective
+from Zope.App.OFS.Services.ServiceManager.ServiceConfiguration \
+ import ServiceConfiguration
from Zope.ComponentArchitecture import getService, getServiceManager
from Zope.Exceptions import ZopeError
from PlacefulSetup import PlacefulSetup
+from Zope.App.Traversing import traverse
+from Zope.App.OFS.Services.ConfigurationInterfaces \
+ import Active, Unregistered, Registered
+from Zope.ComponentArchitecture.GlobalServiceManager \
+ import serviceManager
-from Zope.App.Traversing.IPhysicallyLocatable import IPhysicallyLocatable
-from Zope.App.Traversing.IContainmentRoot import IContainmentRoot
-from Zope.App.Traversing.PhysicalLocationAdapters \
- import WrapperPhysicallyLocatable, RootPhysicallyLocatable
-
-class ITestService(Interface): pass
+class ITestService(Interface):
+ pass
class TestService:
@@ -45,41 +46,28 @@
def setUp(self):
PlacefulSetup.setUp(self)
self.buildFolders()
- from Zope.ComponentArchitecture.GlobalAdapterService \
- import provideAdapter
- from Zope.App.OFS.Services.ServiceManager.IServiceManager \
- import IServiceManager
- from Zope.App.Traversing.ITraversable import ITraversable
- from Zope.App.OFS.Container.IContainer import ISimpleReadContainer
- from Zope.App.OFS.Container.ContainerTraversable \
- import ContainerTraversable
-
- provideAdapter(ISimpleReadContainer, ITraversable,
- ContainerTraversable)
- provideAdapter(
- None, IPhysicallyLocatable, WrapperPhysicallyLocatable)
- provideAdapter(
- IContainmentRoot, IPhysicallyLocatable, RootPhysicallyLocatable)
-
- from Zope.ComponentArchitecture.GlobalServiceManager \
- import serviceManager
serviceManager.defineService('test_service', ITestService)
def _Test__new(self):
return ServiceManager()
+ def createServiceManager(self):
+ self.rootFolder.setServiceManager(ServiceManager())
+
def testGetService(self):
- sm = ServiceManager()
- self.rootFolder.setServiceManager(sm)
- sm = getServiceManager(self.rootFolder)
+ self.createServiceManager()
+ sm = traverse(self.rootFolder, '++etc++Services')
+ default = traverse(sm, 'Packages/default')
+
ts = TestService()
- sm.Packages['default'].setObject('test_service1', ts)
- directive = ServiceDirective(
+ default.setObject('test_service1', ts)
+ configuration = ServiceConfiguration(
'test_service',
'/++etc++Services/Packages/default/test_service1')
- sm.Packages['default'].setObject('test_service1_dir', directive)
- sm.bindService(directive)
+
+ default['configure'].setObject('', configuration)
+ traverse(default, 'configure/1').status = Active
testOb = getService(self.rootFolder, 'test_service')
c = getWrapperContainer
@@ -87,27 +75,28 @@
self.assertEqual(testOb, ts)
def testAddService(self):
- sm = ServiceManager()
- self.rootFolder.setServiceManager(sm)
- sm = getServiceManager(self.rootFolder)
- ts = TestService()
- sm.Packages['default'].setObject('test_service1', ts)
- directive = ServiceDirective(
+ self.createServiceManager()
+ sm = traverse(self.rootFolder, '++etc++Services')
+ default = traverse(sm, 'Packages/default')
+
+ ts1 = TestService()
+ default.setObject('test_service1', ts1)
+ configuration = ServiceConfiguration(
'test_service',
'/++etc++Services/Packages/default/test_service1')
- sm.Packages['default'].setObject('test_service1_dir', directive)
- sm.bindService(directive)
+ default['configure'].setObject('', configuration)
+ traverse(default, 'configure/1').status = Active
ts2 = TestService()
- sm.Packages['default'].setObject('test_service2', ts)
- directive = ServiceDirective(
+ default.setObject('test_service2', ts2)
+ configuration = ServiceConfiguration(
'test_service',
'/++etc++Services/Packages/default/test_service2')
- sm.Packages['default'].setObject('test_service2_dir', directive)
- sm.bindService(directive)
+ default['configure'].setObject('', configuration)
+ traverse(default, 'configure/2').status = Registered
testOb = getService(self.rootFolder, 'test_service')
- self.assertEqual(testOb, ts)
+ self.assertEqual(testOb, ts1)
def testUnbindService(self):
@@ -118,24 +107,10 @@
self.testGetService() # set up localservice
- sm = getServiceManager(self.rootFolder)
-
- directive = sm.Packages['default']['test_service1_dir']
- sm.unbindService(directive)
- self.assertEqual(getService(self.rootFolder, 'test_service'), root_ts)
-
- # XXX This should be a test on the adapter responsible for deleting.
- def __testDeleteService(self):
- """sure deleting a service generates a service generates a
- removed event."""
- self.rootFolder.setServiceManager(ServiceManager())
- sm=getServiceManager(self.rootFolder)
- ts = TestService()
+ sm = traverse(self.rootFolder, '++etc++Services')
+ traverse(sm, 'Packages/default/configure/1').status = Unregistered
- sm.setObject('test_service1', ts)
- sm.bindService('test_service', 'test_service1')
- self.assertEqual(getService(self.rootFolder, 'test_service'), ts)
- self.assertRaises(ZopeError, sm.__delitem__, 'test_service1')
+ self.assertEqual(getService(self.rootFolder, 'test_service'), root_ts)
def testContextServiceLookup(self):
self.testGetService() # set up localservice
=== Removed File Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/tests/TestingServiceManager.py ===
=== Removed File Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/tests/testConfiguration.py ===
=== Removed File Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/tests/testServiceDirective.py ===