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

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

pep8 fixes

File size: 1.8 KB
RevLine 
[3161]1import unittest
2from base import TestCase, LAYERS
[797]3
[3161]4from Products.CMFCore.utils import getToolByName
5
6from quintagroup.plonecaptchas.config import PRODUCT_NAME
7
[3162]8
[2024]9class TestInstallation(TestCase):
[797]10
11    def afterSetUp(self):
12        self.loginAsPortalOwner()
[2004]13        self.skins = getToolByName(self.portal, 'portal_skins', None)
[797]14
[2004]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(),
[3162]21                             '%s directory view not found in portal_skins '\
22                             'after installation' % layer)
[2004]23                self.assert_(layer in path,
24                    '%s layer not found in %s' % (PRODUCT_NAME, skin))
[797]25
[2004]26    def testSkinUninstall(self):
[2024]27        qi = getToolByName(self.portal, 'portal_quickinstaller', None)
28        qi.uninstallProducts([PRODUCT_NAME])
29        assert not qi.isProductInstalled(PRODUCT_NAME)
[963]30
[2004]31        for skin in self.skins.getSkinSelections():
32            path = self.skins.getSkinPath(skin)
[797]33            path = map(str.strip, path.split(','))
[2004]34            for layer in LAYERS:
[3162]35                self.assertTrue(
36                        not layer.split('/')[0] in self.skins.objectIds(),
37                                '%s directory view found in portal_skins '\
38                                'after uninstallation' % layer)
[2004]39                self.assert_(not layer in path,
[3162]40                             '%s layer found in %s skin '\
41                             'after uninstallation' % (layer, skin))
[797]42
[3162]43
[797]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.