[Zope-Checkins] CVS: Zope3/lib/python/Zope/ComponentArchitecture/tests - testService.py:1.1.2.7 testServiceManagerContainer.py:1.1.2.7

Gary Poster garyposter@earthlink.net
Wed, 17 Apr 2002 15:13:07 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/ComponentArchitecture/tests
In directory cvs.zope.org:/tmp/cvs-serv31331/ComponentArchitecture/tests

Modified Files:
      Tag: Zope-3x-branch
	testService.py testServiceManagerContainer.py 
Log Message:
This commit makes the following changes:

The hookable zcml mechanism now requires an intermediary method to overwrite: see the hookables in Zope.ComponentArchitecture for an example

IServiceService, Service, and ServiceManager now all have this signature for the getService method: name.  They did use context, name.  The context, name signature is still used for the main ComponentArchitecture getService function.

the getServiceDefinition function now requires context

A ServiceContainer returns a wrapped ServiceManager; a ServiceManager returns a wrapped Service.

ServiceManager now overrides two ComponentArchitecture hooks: getServiceManager and getNextServiceManager

getNextServiceManager and getNextService are two new ComponentArchitecture functions useful for placeful services

The Zope.Publisher.Browser.BrowserRequest now includes the Zope2 class definition of record: this means that the placeful RoleService is inching forward towards working.

tests have been updated to reflect these changes.



=== Zope3/lib/python/Zope/ComponentArchitecture/tests/testService.py 1.1.2.6 => 1.1.2.7 ===
         d = ServiceTwo()
         provideService('two', d)
-        defs = getServiceDefinitions()
+        defs = getServiceDefinitions(None)
         defs.sort()
         self.assertEqual(defs,
             [('one', IOne), ('two', ITwo)])


=== Zope3/lib/python/Zope/ComponentArchitecture/tests/testServiceManagerContainer.py 1.1.2.6 => 1.1.2.7 ===
 from Zope.ComponentArchitecture.Exceptions import ComponentLookupError
 from Interface.Verify import verifyObject
+from Zope.ContextWrapper import getbaseobject
 
 class ServiceManager:
 
@@ -65,12 +66,13 @@
 
     def testGet(self):
         smc=self._Test__new()
-        self.failUnless(smc.getServiceManager(self) is self)
+        # since the managers are now wrapped, need to look at base object
+        self.failUnless(getbaseobject(smc.getServiceManager(self)) is self)
         self.assertRaises(ComponentLookupError, smc.getServiceManager)
         sm=ServiceManager()
         smc.setServiceManager(sm)
-        self.failUnless(smc.getServiceManager() is sm)
-        self.failUnless(smc.getServiceManager(self) is sm)
+        self.failUnless(getbaseobject(smc.getServiceManager()) is sm)
+        self.failUnless(getbaseobject(smc.getServiceManager(self)) is sm)
 
     def testSet(self):
         smc=self._Test__new()