source: products/quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsUninstall.py @ 3127

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

pep8 passed

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(), '%s layer '
41            'found after uninstallation.' % IPloneCommentsLayer.getName())
42
43    def test_configlet_uninstall(self):
44        configTool = getToolByName(self.portal, 'portal_controlpanel', None)
45        self.failIf(CONFIGLET_ID in [a.getId()
46                                     for a in configTool.listActions()],
47            'Configlet %s found after uninstallation.' % CONFIGLET_ID)
48
49    def test_propertysheet_uninstall(self):
50        portal_properties = getToolByName(self.portal, 'portal_properties')
51        self.failUnless(PROPERTY_SHEET in portal_properties.objectIds(),
52            '%s property_sheet not found in portal_properties after '
53            'uninstallation.' % PROPERTY_SHEET)
54
55
56def test_suite():
57    from unittest import TestSuite, makeSuite
58    suite = TestSuite()
59    suite.addTest(makeSuite(TestUninstallation))
60    return suite
Note: See TracBrowser for help on using the repository browser.