source: products/quintagroup.plonetabs/trunk/quintagroup/plonetabs/tests/test_setup.py @ 3608

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

PPP fixes

File size: 3.2 KB
RevLine 
[756]1import unittest
[865]2
3from plone.browserlayer.utils import registered_layers
4
[756]5from Products.CMFCore.utils import getToolByName
6
7from quintagroup.plonetabs.tests.base import PloneTabsTestCase
8
[3437]9
[756]10class TestSetup(PloneTabsTestCase):
[3437]11
[756]12    def afterSetUp(self):
[865]13        self.loginAsPortalOwner()
[3437]14
[756]15    def test_actionIcons(self):
16        tool = getToolByName(self.portal, 'portal_actionicons')
17        icon_ids = [i._action_id for i in tool.listActionIcons()]
[3608]18        self.failUnless('plonetabs' in icon_ids, 'There is no plonetabs action'
19                        'icon in actionicons tool.')
[3437]20
[756]21    def test_controlPanel(self):
22        tool = getToolByName(self.portal, 'portal_controlpanel')
23        action_ids = [a.id for a in tool.listActions()]
24        self.failUnless('plonetabs' in action_ids,
[3608]25                        'There is no plonetabs action in control panel.')
[3437]26
[756]27    def test_cssRegistry(self):
28        tool = getToolByName(self.portal, 'portal_css')
29        css = tool.getResource('++resource++plonetabs.css')
[3608]30        self.failIf(css is None, 'There is no ++resource++plonetabs.css '
31                    'stylesheets registered.')
[3437]32
[756]33    def test_jsRegistry(self):
34        tool = getToolByName(self.portal, 'portal_javascripts')
[3437]35
[756]36        prototype = tool.getResource('++resource++prototype.js')
37        self.failIf(prototype is None,
[3608]38                    'There is no ++resource++prototype.js script registered.')
[756]39        self.failUnless(prototype._data['enabled'],
[3608]40                        '++resource++prototype.js script is disabled.')
[3437]41
[756]42        effects = tool.getResource('++resource++pt_effects.js')
43        self.failIf(effects is None,
[3608]44                    'There is no ++resource++pt_effects.js script registered.')
[3437]45
[756]46        dad = tool.getResource('++resource++sa_dragdrop.js')
[3608]47        self.failIf(dad is None, 'There is no ++resource++sa_dragdrop.js '
48                    'script registered.')
[756]49
50    def test_kssRegistry(self):
51        tool = getToolByName(self.portal, 'portal_kss')
52        kss = tool.getResource('++resource++plonetabs.kss')
53        self.failIf(kss is None,
[3608]54                    'There is no ++resource++plonetabs.kss sheets registered.')
[872]55        kss = tool.getResource('++resource++plonetabsmode.kss')
[3608]56        self.failIf(kss is None, 'There is no ++resource++plonetabsmode.kss '
57                    'sheets registered.')
[3437]58
[756]59    def test_propertiesTool(self):
60        tool = getToolByName(self.portal, 'portal_properties')
[3608]61        self.failUnless(hasattr(tool, 'tabs_properties'), 'There is no '
62                        'tabs_properties sheet in portal properties tool.')
[756]63        titles = tool.tabs_properties.getProperty('titles', None)
64        self.assertEquals(titles,
[3608]65                          ('portal_tabs|Portal Tabs Configuration',
66                           'portal_footer|Portal Footer Configuration'),
67                          'Site properties was not setup properly'
68                          )
[3437]69
[865]70    def test_browserLayerRegistered(self):
71        layers = [o.__name__ for o in registered_layers()]
[3608]72        self.failUnless('IPloneTabsProductLayer' in layers, 'There should be '
73                        'quintagroup.ploentabs browser layer registered.')
[756]74
[3437]75
[756]76def test_suite():
77    suite = unittest.TestSuite()
78    suite.addTest(unittest.makeSuite(TestSetup))
79    return suite
Note: See TracBrowser for help on using the repository browser.