source: products/quintagroup.plonecaptchas/trunk/quintagroup/plonecaptchas/tests/testInstallation.py @ 3161

Last change on this file since 3161 was 3161, checked in by vmaksymiv, 13 years ago

pyflakes fixes

File size: 1.6 KB
Line 
1import unittest
2from base import TestCase, LAYERS
3
4from Products.CMFCore.utils import getToolByName
5
6from quintagroup.plonecaptchas.config import PRODUCT_NAME
7
8class TestInstallation(TestCase):
9
10    def afterSetUp(self):
11        self.loginAsPortalOwner()
12        self.skins = getToolByName(self.portal, 'portal_skins', None)
13
14    def testSkinInstall(self):
15        for skin in self.skins.getSkinSelections():
16            path = self.skins.getSkinPath(skin)
17            path = map(str.strip, path.split(','))
18            for layer in LAYERS:
19                self.assert_(layer.split('/')[0] in self.skins.objectIds(),
20                    '%s directory view not found in portal_skins after installation' % layer)
21                self.assert_(layer in path,
22                    '%s layer not found in %s' % (PRODUCT_NAME, skin))
23
24    def testSkinUninstall(self):
25        qi = getToolByName(self.portal, 'portal_quickinstaller', None)
26        qi.uninstallProducts([PRODUCT_NAME])
27        assert not qi.isProductInstalled(PRODUCT_NAME)
28
29        for skin in self.skins.getSkinSelections():
30            path = self.skins.getSkinPath(skin)
31            path = map(str.strip, path.split(','))
32            for layer in LAYERS:
33                self.assertTrue(not layer.split('/')[0] in self.skins.objectIds(),
34                    '%s directory view found in portal_skins after uninstallation' % layer)
35                self.assert_(not layer in path,
36                    '%s layer found in %s skin after uninstallation' % (layer, skin))
37
38def test_suite():
39    suite = unittest.TestSuite()
40    suite.addTest(unittest.makeSuite(TestInstallation))
41    return suite
Note: See TracBrowser for help on using the repository browser.