[Zope3-checkins] CVS: Zope3/src/zope/app/content/tests - test_sqlscript.py:1.14.6.2

Jim Fulton jim at zope.com
Mon Sep 8 19:37:23 EDT 2003


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

Modified Files:
      Tag: parentgeddon-branch
	test_sqlscript.py 
Log Message:
got more tests to pass

=== Zope3/src/zope/app/content/tests/test_sqlscript.py 1.14.6.1 => 1.14.6.2 ===
--- Zope3/src/zope/app/content/tests/test_sqlscript.py:1.14.6.1	Mon Sep  8 14:21:35 2003
+++ Zope3/src/zope/app/content/tests/test_sqlscript.py	Mon Sep  8 18:36:52 2003
@@ -22,7 +22,7 @@
 from zope.app.interfaces.rdb import IZopeConnection
 from zope.app.interfaces.rdb import IZopeCursor
 from zope.component import getService
-from zope.app.services.servicenames import Adapters, Utilities
+from zope.app.services.servicenames import Adapters
 from zope.app.component import nextservice
 from zope.component.service import serviceManager as sm
 from zope.app.tests.placelesssetup import PlacelessSetup
@@ -100,6 +100,16 @@
         return self.cache.get((obj, keywords), default)
 
 
+class CachingServiceStub:
+
+    implements(ICachingService, ISimpleService)
+
+    def __init__(self):
+        self.caches = {}
+
+    def getCache(self, name):
+        return self.caches[name]
+
 class LocatableStub:
 
     implements(IPhysicallyLocatable)
@@ -123,6 +133,9 @@
         sm.provideService('SQLDatabaseConnections', ConnectionServiceStub())
         self._old_getNextServiceManager = nextservice.getNextServiceManager
         nextservice.getNextServiceManager = getNextServiceManager
+        self.caching_service = CachingServiceStub()
+        sm.defineService('Caching', ICachingService)
+        sm.provideService('Caching', self.caching_service)
         getService(None, Adapters).provideAdapter(
             IAttributeAnnotatable, IAnnotations,
             AttributeAnnotations)
@@ -188,10 +201,7 @@
         self.assertEqual(result[0].counter, 2)
         # caching: and check that the counter stays still
         AnnotationCacheable(script).setCacheId('dumbcache')
-
-
-        getService(None, Utilities).provideUtility(
-            ICache, CacheStub(), 'dumbcache')
+        self.caching_service.caches['dumbcache'] = CacheStub()
         result = script(id=1)
         self.assertEqual(result[0].counter, 3)
         result = script(id=1)




More information about the Zope3-Checkins mailing list