1 | # |
---|
2 | # Test product's uninstallation |
---|
3 | # |
---|
4 | |
---|
5 | import unittest |
---|
6 | |
---|
7 | from base import getToolByName, TestErase |
---|
8 | from config import PRODUCT, PRODUCT_SKIN_NAME, CONFIGLET_ID, PROPERTY_SHEET |
---|
9 | |
---|
10 | |
---|
11 | class 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 | |
---|
49 | def test_suite(): |
---|
50 | from unittest import TestSuite, makeSuite |
---|
51 | suite = TestSuite() |
---|
52 | suite.addTest(makeSuite(TestUninstallation)) |
---|
53 | return suite |
---|