[Zope3-checkins] CVS: Zope3/src/zope/app/services/tests - test_folder.py:1.1 placefulsetup.py:1.15

Jim Fulton jim@zope.com
Sun, 23 Mar 2003 12:13:43 -0500


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

Modified Files:
	placefulsetup.py 
Added Files:
	test_folder.py 
Log Message:
added a site-management folder api to get the conguration manager

=== Added File Zope3/src/zope/app/services/tests/test_folder.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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.
#
##############################################################################
"""Site-management folder tests

$Id: test_folder.py,v 1.1 2003/03/23 17:13:42 jim Exp $
"""

import unittest
from zope.app.services.tests import placefulsetup
from zope.app.traversing import traverse
from zope.app.services.configuration import ConfigurationManager

class TestSomething(placefulsetup.PlacefulSetup, unittest.TestCase):

    def test_getConfigurationManager(self):
        self.buildFolders()
        sm = placefulsetup.createServiceManager(self.rootFolder)
        default = traverse(sm, 'default')
        self.assertEqual(default.getConfigurationManager(),
                         default['configure'])
        del default['configure']
        default.setObject('xxx', ConfigurationManager())
        self.assertEqual(default.getConfigurationManager(),
                         default['xxx'])
        del default['xxx']
        self.assertRaises(Exception, # don't care what it raised
                          default.getConfigurationManager)
        

def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TestSomething))
    return suite


if __name__ == '__main__':
    unittest.main()


=== Zope3/src/zope/app/services/tests/placefulsetup.py 1.14 => 1.15 ===
--- Zope3/src/zope/app/services/tests/placefulsetup.py:1.14	Wed Mar 19 14:57:32 2003
+++ Zope3/src/zope/app/services/tests/placefulsetup.py	Sun Mar 23 12:13:42 2003
@@ -226,3 +226,7 @@
         default['configure'].setObject("myHubIdsServiceDir", configuration)
         traverse(default, 'configure/3').status = Active
 
+
+def createServiceManager(folder):
+    folder.setServiceManager(ServiceManager())
+    return traverse(folder, "++etc++Services")