source: products/quintagroup.plonecaptchas/branches/plone3/quintagroup/plonecaptchas/tests/testInstallation.py @ 3610

Last change on this file since 3610 was 3610, checked in by vmaksymiv, 11 years ago

PPP fixes

File size: 1.7 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
8
9class TestInstallation(TestCase):
10
11    def afterSetUp(self):
12        self.loginAsPortalOwner()
13        self.skins = getToolByName(self.portal, 'portal_skins', None)
14
15    def testSkinInstall(self):
16        for skin in self.skins.getSkinSelections():
17            path = self.skins.getSkinPath(skin)
18            path = map(str.strip, path.split(','))
19            for layer in LAYERS:
20                self.assert_(layer.split('/')[0] in self.skins.objectIds(),
21                             '%s directory view not found in portal_skins '
22                             'after installation' % layer)
23                self.assert_(layer in path,
24                             '%s layer not found in %s' % (PRODUCT_NAME, skin))
25
26    def testSkinUninstall(self):
27        qi = getToolByName(self.portal, 'portal_quickinstaller', None)
28        qi.uninstallProducts([PRODUCT_NAME])
29        assert not qi.isProductInstalled(PRODUCT_NAME)
30
31        for skin in self.skins.getSkinSelections():
32            path = self.skins.getSkinPath(skin)
33            path = map(str.strip, path.split(','))
34            for layer in LAYERS:
35                self.assertTrue(
36                    not layer.split('/')[0] in self.skins.objectIds(),
37                    '%s directory view found in portal_skins '
38                    'after uninstallation' % layer)
39                self.assert_(not layer in path,
40                             '%s layer found in %s skin '
41                             'after uninstallation' % (layer, skin))
42
43
44def test_suite():
45    suite = unittest.TestSuite()
46    suite.addTest(unittest.makeSuite(TestInstallation))
47    return suite
Note: See TracBrowser for help on using the repository browser.