[Zope3-checkins] CVS: Zope3/src/zope/app/services/tests - test_cacheconfiguration.py:1.8.10.1 test_configurationmanager.py:1.8.8.1 test_connectionconfiguration.py:1.9.8.1 test_connectionservice.py:1.8.8.1 test_serviceconfiguration.py:1.9.8.1
Steve Alexander
steve@cat-box.net
Thu, 15 May 2003 10:50:02 -0400
Update of /cvs-repository/Zope3/src/zope/app/services/tests
In directory cvs.zope.org:/tmp/cvs-serv12712/src/zope/app/services/tests
Modified Files:
Tag: stevea-decorators-branch
test_cacheconfiguration.py test_configurationmanager.py
test_connectionconfiguration.py test_connectionservice.py
test_serviceconfiguration.py
Log Message:
More work on Decorators.
Converted existing tests to use decorators instead of ZopeContainerAdapter.
=== Zope3/src/zope/app/services/tests/test_cacheconfiguration.py 1.8 => 1.8.10.1 ===
--- Zope3/src/zope/app/services/tests/test_cacheconfiguration.py:1.8 Thu Apr 24 17:10:19 2003
+++ Zope3/src/zope/app/services/tests/test_cacheconfiguration.py Thu May 15 10:49:30 2003
@@ -21,7 +21,6 @@
from zope.app.services.tests.placefulsetup import PlacefulSetup
from zope.app.traversing import traverse
from zope.app.services.service import ServiceManager
-from zope.app.container.zopecontainer import ZopeContainerAdapter
from zope.app.interfaces.services.configuration import Active, Unregistered
from zope.app.interfaces.cache.cache import ICache
from zope.app.interfaces.dependable import IDependable
@@ -109,7 +108,7 @@
self.default.setObject('cch', TestCache())
self.cch = traverse(self.default, 'cch')
- self.cm = ZopeContainerAdapter(self.default.getConfigurationManager())
+ self.cm = ContextWrapper(self.default.getConfigurationManager(), None)
self.cm.setObject('', CacheConfiguration('cache_name',
'/++etc++site/default/cch'))
self.config = traverse(self.default.getConfigurationManager(), '1')
=== Zope3/src/zope/app/services/tests/test_configurationmanager.py 1.8 => 1.8.8.1 ===
--- Zope3/src/zope/app/services/tests/test_configurationmanager.py:1.8 Thu May 1 15:35:35 2003
+++ Zope3/src/zope/app/services/tests/test_configurationmanager.py Thu May 15 10:49:30 2003
@@ -16,7 +16,6 @@
"""
from unittest import TestCase, main, makeSuite
-from zope.app.container.zopecontainer import ZopeContainerAdapter
from zope.app.interfaces.container import IContainer
from zope.app.interfaces.container import IDeleteNotifiable
from zope.app.interfaces.container import IZopeContainer
@@ -28,7 +27,8 @@
from zope.component.adapter import provideAdapter
from zope.interface.common.tests.basemapping import BaseTestIEnumerableMapping
from zope.interface.verify import verifyObject
-
+from zope.proxy.context import ContextWrapper
+from zope.app.component.decoratorservice import registerDecoratorForClass
class Undeletable:
@@ -44,6 +44,9 @@
def setUp(self):
PlacelessSetup.setUp(self)
+ registerDecoratorForClass(ConfigurationManager,
+ 'zope.app.container.contextdecorator',
+ 'context')
self.__manager = manager = ConfigurationManager()
for l in 'abcdefghijklmnop':
manager.setObject('', l)
@@ -334,9 +337,8 @@
#########################################################
def test_manageBeforeDelete(self):
- provideAdapter(IContainer, IZopeContainer, ZopeContainerAdapter)
container = []
- manager = ConfigurationManager()
+ manager = ContextWrapper(ConfigurationManager(), None)
thingy = Undeletable()
manager.setObject('xyzzy', thingy)
manager.beforeDeleteHook(manager, container)
@@ -369,7 +371,6 @@
default.__delitem__, 'configuration')
default.setObject('xxx', ConfigurationManager())
del default['RegistrationManager']
-
def test_suite():
=== Zope3/src/zope/app/services/tests/test_connectionconfiguration.py 1.9 => 1.9.8.1 ===
--- Zope3/src/zope/app/services/tests/test_connectionconfiguration.py:1.9 Thu May 1 15:35:35 2003
+++ Zope3/src/zope/app/services/tests/test_connectionconfiguration.py Thu May 15 10:49:30 2003
@@ -23,7 +23,6 @@
from zope.app.services.tests.placefulsetup import PlacefulSetup
from zope.app.traversing import traverse
from zope.app.services.service import ServiceManager
-from zope.app.container.zopecontainer import ZopeContainerAdapter
from zope.app.interfaces.services.configuration import Active, Unregistered
from zope.app.interfaces.rdb import IZopeDatabaseAdapter
from zope.app.interfaces.dependable import IDependable
@@ -100,7 +99,7 @@
self.default.setObject('da', TestDA())
self.da = traverse(self.default, 'da')
- self.cm = ZopeContainerAdapter(self.default.getConfigurationManager())
+ self.cm = ContextWrapper(self.default.getConfigurationManager(), None)
self.cm.setObject('', ConnectionConfiguration('conn_name',
'/++etc++site/default/da'))
self.config = traverse(self.default.getConfigurationManager(), '1')
=== Zope3/src/zope/app/services/tests/test_connectionservice.py 1.8 => 1.8.8.1 ===
--- Zope3/src/zope/app/services/tests/test_connectionservice.py:1.8 Thu May 1 15:35:35 2003
+++ Zope3/src/zope/app/services/tests/test_connectionservice.py Thu May 15 10:49:30 2003
@@ -18,7 +18,6 @@
import unittest
from zope.app.attributeannotations import AttributeAnnotations
-from zope.app.container.zopecontainer import ZopeContainerAdapter
from zope.app.dependable import Dependable
from zope.app.interfaces.annotation import IAnnotatable
from zope.app.interfaces.annotation import IAnnotations
@@ -79,7 +78,7 @@
self.default.setObject('conn_srv', ConnectionServiceForTests())
self.service = traverse(self.default, 'conn_srv')
- self.cm = ZopeContainerAdapter(self.default.getConfigurationManager())
+ self.cm = self.default.getConfigurationManager()
self.cm.setObject('', ServiceConfiguration('SQLDatabaseConnections',
'/++etc++site/default/conn_srv'))
traverse(self.default.getConfigurationManager(), '1').status = Active
@@ -107,7 +106,7 @@
default1.setObject('conn_srv1', ConnectionServiceForTests())
self.service1 = traverse(default1, 'conn_srv1')
- cm1 = ZopeContainerAdapter(default1.getConfigurationManager())
+ cm1 = default1.getConfigurationManager()
cm1.setObject('', ServiceConfiguration('SQLDatabaseConnections',
'/folder1/++etc++site/default/conn_srv1'))
traverse(default1.getConfigurationManager(), '1').status = Active
=== Zope3/src/zope/app/services/tests/test_serviceconfiguration.py 1.9 => 1.9.8.1 ===
--- Zope3/src/zope/app/services/tests/test_serviceconfiguration.py:1.9 Thu May 1 15:35:35 2003
+++ Zope3/src/zope/app/services/tests/test_serviceconfiguration.py Thu May 15 10:49:30 2003
@@ -37,8 +37,8 @@
from zope.app.interfaces.dependable import IDependable
from zope.app.interfaces.dependable import DependencyError
-from zope.app.container.zopecontainer import ZopeContainerAdapter
-
+from zope.app.services.configuration import ConfigurationManager
+from zope.app.component.decoratorservice import registerDecoratorForClass
class ITestService(Interface):
pass
@@ -78,6 +78,11 @@
def setUp(self):
PlacefulSetup.setUp(self)
+ # XXX: Perhaps we should have an explicit "contextdecoratecontainer"
+ # call?
+ registerDecoratorForClass(ConfigurationManager,
+ 'zope.app.container.contextdecorator',
+ 'context')
self.buildFolders()
self.rootFolder.setServiceManager(ServiceManager())
defineService('test_service', ITestService)
@@ -92,7 +97,7 @@
'test_service', '/++etc++site/default/c')
self.__c = traverse(default, 'c')
- self.__cm = ZopeContainerAdapter(default.getConfigurationManager())
+ self.__cm = default.getConfigurationManager()
self.__cm.setObject('', configuration)