source: products/quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/tests/test_installation.py @ 2873

Last change on this file since 2873 was 2873, checked in by mylan, 14 years ago

#232: Added installation tests

  • Property svn:eol-style set to native
File size: 2.0 KB
Line 
1#
2# Test product's installation
3#
4import string
5from zope.component import queryUtility
6from zope.component import queryMultiAdapter
7from zope.viewlet.interfaces import IViewletManager
8from plone.registry.interfaces import IRegistry
9from plone.browserlayer import utils as blutils
10
11from base import *
12CSS_RESOURCES = ["++resource++drop_down.css",]
13DEPENDENCIES = ["plone.app.registry",]
14CONFIGLETS = ["dropdownmenu",]
15
16class TestInstallation(TestCase):
17
18    def testInstalled(self):
19        qi = self.portal.portal_quickinstaller
20        self.assertTrue(qi.isProductInstalled(PROJECT_NAME),
21            '%s is not installed.' % PROJECT_NAME)
22
23    def testInstalledDependencies(self):
24        cp = self.portal.portal_controlpanel
25        configlets = [ai['id'] for ai in cp.listActionInfos(check_permissions=0)]
26        self.assertTrue([1 for ai in configlets if ai=="plone.app.registry"], 
27                'Not installed required plone.app.registry product.')
28
29    def testStyles(self):
30        """ Test styles registration."""
31        cssreg = getToolByName(self.portal, "portal_css")
32        for res in CSS_RESOURCES:
33            self.assertNotEqual(cssreg.getResource(res), None)
34
35    def testConfiglet(self):
36        cp = self.portal.portal_controlpanel
37        configlets = [ai['id'] for ai in cp.listActionInfos(check_permissions=0)]
38        for cid in CONFIGLETS:
39            self.assertTrue([1 for ai in configlets if ai==cid], 
40                'No "%s" configlet added to plone control panel' % cid)
41
42    def testBrowserLayer(self):
43        self.assert_(IDropDownMenuLayer in blutils.registered_layers(),
44                     "Not registered 'IDropDownMenuLayer' browser layer")
45
46    def testRegistry(self):
47        registry = queryUtility(IRegistry)
48        afield = "show_content_tabs"
49        self.assertTrue(registry.records.get(IPREFIX+afield, None),
50            "Not registered '%s' registry interface" % IPREFIX)
51
52
53def test_suite():
54    from unittest import TestSuite, makeSuite
55    suite = TestSuite()
56    suite.addTest(makeSuite(TestInstallation))
57    return suite
Note: See TracBrowser for help on using the repository browser.