Back to index

plone3  3.1.7
testControlPanel.py
Go to the documentation of this file.
00001 #
00002 # Tests the ControlPanel
00003 #
00004 
00005 
00006 from Products.CMFCore.utils import getToolByName
00007 from Products.CMFPlone.tests import PloneTestCase
00008 
00009 
00010 class TestControlPanel(PloneTestCase.PloneTestCase):
00011 
00012     def afterSetUp(self):
00013         self.controlpanel = getToolByName(self.portal, "portal_controlpanel")
00014         
00015         # get the expected default groups and configlets
00016         self.groups     = ['Plone', 'Products', 'Member']
00017         self.configlets = ['QuickInstaller', 'portal_atct', 'MailHost',
00018                            'UsersGroups', 'MemberPrefs', 'PortalSkin',
00019                            'MemberPassword', 'ZMI', 'SecuritySettings',
00020                            'NavigationSettings', 'SearchSettings',
00021                            'errorLog', 'kupu', 'PloneReconfig',
00022                            'CalendarSettings', 'TypesSettings', 
00023                            'PloneLanguageTool', 'CalendarSettings',
00024                            'HtmlFilter', 'Maintenance']
00025 
00026     def testDefaultGroups(self):
00027         for group in self.groups:
00028             self.failUnless(group in self.controlpanel.getGroupIds(),
00029                             "Missing group with id '%s'" % group)
00030 
00031     def testDefaultConfiglets(self):
00032         for title in self.configlets:
00033             self.failUnless(title in [a.getAction(self)['id']
00034                                    for a in self.controlpanel.listActions()],
00035                             "Missing configlet with id '%s'" % title)
00036 
00037 
00038 def test_suite():
00039     from unittest import TestSuite, makeSuite
00040     suite = TestSuite()
00041     suite.addTest(makeSuite(TestControlPanel))
00042     return suite