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