Author: jmorliaguet Date: Thu Apr 20 18:38:44 2006 New Revision: 2917 Added: cpsskins/branches/paris-sprint-2006/doc/registration.txt (contents, props changed) cpsskins/branches/paris-sprint-2006/ftests/test_registration.py (contents, props changed) Log:
- added a doc for testing the new registration API Added: cpsskins/branches/paris-sprint-2006/doc/registration.txt ============================================================================== --- (empty file) +++ cpsskins/branches/paris-sprint-2006/doc/registration.txt Thu Apr 20 18:38:44 2006 @@ -0,0 +1,51 @@ + +============ +REGISTRATION +============ + +This is meant for testing the new Zope3 registration API + + >>> from cpsskins.utils import getThemeManager + >>> from zope.component import getSiteManager + + >>> from cpsskins.thememanager import ThemeManagementFolder + >>> from cpsskins.thememanager import IThemeManagementFolder + +Create a site structure: + + >>> from zope.app.folder import Folder + >>> root = getRootFolder() + >>> folder = root[u'folder'] = Folder() + >>> subfolder = root[u'folder'][u'subfolder'] = Folder() + +Turn the folder into a local site manager: + + >>> from zope.app.testing import setup + >>> sm = setup.createSiteManager(folder, True) + + >>> getSiteManager(folder) is sm + True + + >>> getSiteManager(subfolder) is sm + True + +Create a theme management folder and register it as a local utility +in the local site manager + + >>> tmutil = ThemeManagementFolder() + >>> sm.registerUtility(tmutil, IThemeManagementFolder) + + >>> sm.getUtility(IThemeManagementFolder) is tmutil + True + +The theme management folder is available through getThemeManager(context) + + >>> getThemeManager(folder) is tmutil + True + + >>> getThemeManager(folder) is tmutil + True + + >>> getThemeManager(root) is None + True + Added: cpsskins/branches/paris-sprint-2006/ftests/test_registration.py ============================================================================== --- (empty file) +++ cpsskins/branches/paris-sprint-2006/ftests/test_registration.py Thu Apr 20 18:38:44 2006 @@ -0,0 +1,32 @@ +############################################################################## +# +# Copyright (c) 2005-2006 Nuxeo and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (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. +# +############################################################################## +"""Registration tests + +$Id:$ +""" +__docformat__ = "reStructuredText" + +import unittest + +from zope.app.testing.functional import FunctionalDocFileSuite + +from cpsskins.tests.setup import setUp + +def test_suite(): + return unittest.TestSuite(( + FunctionalDocFileSuite('../doc/registration.txt', setUp=setUp), + )) + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite') -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins