[Zope-Checkins] CVS: Zope3/lib/python/Zope/Configuration/tests - __init__.py:1.1.2.4 hookTestDummyModule.py:1.1.2.2 testHookRegistry.py:1.1.2.2
Gary Poster
garyposter@earthlink.net
Wed, 17 Apr 2002 15:12:38 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Configuration/tests
In directory cvs.zope.org:/tmp/cvs-serv31331/Configuration/tests
Modified Files:
Tag: Zope-3x-branch
__init__.py hookTestDummyModule.py testHookRegistry.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/Configuration/tests/__init__.py 1.1.2.3 => 1.1.2.4 ===
##############################################################################
""" Configuration unit tests."""
+
+from hookTestDummyModule import dummyHookable as testImport
=== Zope3/lib/python/Zope/Configuration/tests/hookTestDummyModule.py 1.1.2.1 => 1.1.2.2 ===
def dummyHookable():
- return "original implementation"
\ No newline at end of file
+ return dummyHookable_hook()
+
+def dummyHookable_hook():
+ return "original implementation"
+
+def associatedDummy():
+ return dummyHookable()
=== Zope3/lib/python/Zope/Configuration/tests/testHookRegistry.py 1.1.2.1 => 1.1.2.2 ===
HookRegistry, BadHookError, DuplicateHookError, \
MissingHookableError
+ from Zope.Configuration.tests.hookTestDummyModule import associatedDummy
hookableParent='Zope.Configuration.tests.hookTestDummyModule'
hookableLast='dummyHookable'
hookableAddr='%s.%s' % (hookableParent, hookableLast)
-
- hookRegistry=HookRegistry()
- hookRegistry.addHookable(hookableAddr)
old=__import__(hookableParent,{},{}, ('__dict__',)) # for cleanup
old=getattr(old, hookableLast)
self.assertEquals(old(),"original implementation")
+
+ hookRegistry=HookRegistry()
+ hookRegistry.addHookable(hookableAddr)
self.assertRaises(BadHookError, hookRegistry.addHook,
hookableAddr, 'foo.bar.this.should.not.resolve.anywhere')
hookRegistry.addHook(hookableAddr,
@@ -87,6 +88,9 @@
new=__import__(hookableParent,{},{}, ('__dict__',))
new=getattr(new, hookableLast)
self.assertEquals(new(), "hooked implementation")
+ self.assertEquals(associatedDummy(), "hooked implementation")
+ from Zope.Configuration.tests.hookTestDummyModule import associatedDummy as associatedDummyAgain
+ self.assertEquals(associatedDummyAgain(), "hooked implementation")
self.assertRaises(DuplicateHookError, hookRegistry.addHook,
hookableAddr, 'Zope.Configuration.tests.testHookRegistry.test_suite')
self.assertRaises(MissingHookableError, hookRegistry.addHook,