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

Last change on this file since 1840 was 1633, checked in by kroman0, 14 years ago

Fixed tests for quintagroup.plonecomments

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