source: products/quintagroup.plonecomments/branches/jquery/quintagroup/plonecomments/tests/testQPloneCommentsUninstall.py @ 3110

Last change on this file since 3110 was 3110, checked in by kroman0, 13 years ago

Pylint fixes #2

File size: 2.3 KB
Line 
1#
2# Test product's uninstallation
3#
4
5from Products.CMFCore.utils import getToolByName
6from quintagroup.plonecomments.tests.base import TestErase
7from quintagroup.plonecomments.tests.config import PRODUCT, \
8    PRODUCT_SKIN_NAME, CONFIGLET_ID, PROPERTY_SHEET
9from zExceptions import BadRequest
10
11
12class TestUninstallation(TestErase):
13
14    def afterSetUp(self):
15        self.loginAsPortalOwner()
16        self.qi = self.portal.portal_quickinstaller
17        self.qi.installProduct(PRODUCT)
18        try:
19            self.qi.uninstallProducts([PRODUCT])
20        except BadRequest:
21            pass
22
23    def test_package_uninstall(self):
24        self.failIf(self.qi.isProductInstalled(PRODUCT),
25            '%s is not uninstalled.' % PRODUCT)
26
27    def test_skins_uninstall(self):
28        skinstool = getToolByName(self.portal, 'portal_skins')
29        self.failIf(PRODUCT_SKIN_NAME in skinstool.objectIds(),
30            'There is still %s folder in portal_skins.' % PRODUCT_SKIN_NAME)
31        for skin in skinstool.getSkinSelections():
32            path = skinstool.getSkinPath(skin)
33            layers = map(str.strip, path.split(','))
34            self.failIf(PRODUCT_SKIN_NAME in layers,
35                '%s layer is still in %s.' % (PRODUCT_SKIN_NAME, skin))
36
37    def test_layer_uninstall(self):
38        from plone.browserlayer.utils import registered_layers
39        from quintagroup.plonecomments.interfaces import IPloneCommentsLayer
40        self.failIf(IPloneCommentsLayer in registered_layers(),
41            '%s layer found after uninstallation.' %
42            IPloneCommentsLayer.getName())
43
44    def test_configlet_uninstall(self):
45        configTool = getToolByName(self.portal, 'portal_controlpanel', None)
46        self.failIf(CONFIGLET_ID in [a.getId()
47                                     for a in configTool.listActions()],
48            'Configlet %s found after uninstallation.' % CONFIGLET_ID)
49
50    def test_propertysheet_uninstall(self):
51        portal_properties = getToolByName(self.portal, 'portal_properties')
52        self.failUnless(PROPERTY_SHEET in portal_properties.objectIds(),
53            '%s property_sheet not found in portal_properties'
54            ' after uninstallation.' % PROPERTY_SHEET)
55
56
57def test_suite():
58    from unittest import TestSuite, makeSuite
59    suite = TestSuite()
60    suite.addTest(makeSuite(TestUninstallation))
61    return suite
Note: See TracBrowser for help on using the repository browser.