[1181] | 1 | # -*- coding: utf-8 -*- |
---|
| 2 | import unittest |
---|
| 3 | from plone.registry import Registry |
---|
| 4 | |
---|
[3153] | 5 | from base import TestCase |
---|
| 6 | from base import IPREFIX |
---|
[1181] | 7 | |
---|
[3153] | 8 | from Products.CMFCore.utils import getToolByName |
---|
[1181] | 9 | from quintagroup.dropdownmenu.interfaces import IDropDownMenuSettings |
---|
| 10 | |
---|
[3151] | 11 | |
---|
[2871] | 12 | class RegistryTest(TestCase): |
---|
[1181] | 13 | |
---|
| 14 | def afterSetUp(self): |
---|
| 15 | # Set up the registry |
---|
[2871] | 16 | super(RegistryTest, self).afterSetUp() |
---|
[1181] | 17 | self.registry = Registry() |
---|
| 18 | self.registry.registerInterface(IDropDownMenuSettings) |
---|
| 19 | |
---|
| 20 | def test_dropdownmenu_in_controlpanel(self): |
---|
| 21 | # Check if dropdownmenu is in the control panel |
---|
| 22 | self.controlpanel = getToolByName(self.portal, "portal_controlpanel") |
---|
[3514] | 23 | self.failUnless('dropdownmenu' in [ |
---|
| 24 | a.getAction(self)['id'] |
---|
| 25 | for a in self.controlpanel.listActions()]) |
---|
[1181] | 26 | |
---|
[1197] | 27 | def test_show_icons(self): |
---|
| 28 | # Check show_icons record |
---|
[3153] | 29 | self.registry.records[IPREFIX + 'show_icons'] |
---|
[1197] | 30 | |
---|
| 31 | self.failUnless('show_icons' in IDropDownMenuSettings) |
---|
[3151] | 32 | self.assertEquals(self.registry[IPREFIX + 'show_icons'], False) |
---|
[1197] | 33 | |
---|
[1181] | 34 | def test_show_content_tabs(self): |
---|
| 35 | # Check show_content_tabs record |
---|
[3153] | 36 | self.registry.records[IPREFIX + 'show_content_tabs'] |
---|
[1181] | 37 | |
---|
| 38 | self.failUnless('show_content_tabs' in IDropDownMenuSettings) |
---|
[3151] | 39 | self.assertEquals(self.registry[IPREFIX + 'show_content_tabs'], True) |
---|
[1181] | 40 | |
---|
| 41 | def test_show_nonfolderish_tabs(self): |
---|
| 42 | # Check show_nonfolderish_tabs record |
---|
[3153] | 43 | self.registry.records[IPREFIX + 'show_nonfolderish_tabs'] |
---|
[1181] | 44 | |
---|
| 45 | self.failUnless('show_nonfolderish_tabs' in IDropDownMenuSettings) |
---|
[3151] | 46 | self.assertEquals(self.registry[IPREFIX + 'show_nonfolderish_tabs'], |
---|
[1181] | 47 | True) |
---|
| 48 | |
---|
| 49 | def test_content_before_actions_tabs(self): |
---|
| 50 | # Check content_before_actions_tabs record |
---|
[3153] | 51 | self.registry.records[IPREFIX + 'content_before_actions_tabs'] |
---|
[1181] | 52 | |
---|
| 53 | self.failUnless('content_before_actions_tabs' in IDropDownMenuSettings) |
---|
[3151] | 54 | self.assertEquals(self.registry[ |
---|
| 55 | IPREFIX + 'content_before_actions_tabs'], False) |
---|
[1181] | 56 | |
---|
| 57 | def test_content_tabs_level(self): |
---|
| 58 | # Check content_tabs_level record |
---|
[3153] | 59 | self.registry.records[IPREFIX + 'content_tabs_level'] |
---|
[1181] | 60 | |
---|
| 61 | self.failUnless('content_tabs_level' in IDropDownMenuSettings) |
---|
[3151] | 62 | self.assertEquals(self.registry[IPREFIX + 'content_tabs_level'], 0) |
---|
[1181] | 63 | |
---|
| 64 | def test_show_actions_tabs(self): |
---|
| 65 | # Check show_actions_tabs record |
---|
[3153] | 66 | self.registry.records[IPREFIX + 'show_actions_tabs'] |
---|
[1181] | 67 | |
---|
| 68 | self.failUnless('show_actions_tabs' in IDropDownMenuSettings) |
---|
[3151] | 69 | self.assertEquals(self.registry[IPREFIX + 'show_actions_tabs'], True) |
---|
[1181] | 70 | |
---|
| 71 | def test_actions_tabs_level(self): |
---|
| 72 | # Check actions_tabs_level record |
---|
[3153] | 73 | self.registry.records[IPREFIX + 'actions_tabs_level'] |
---|
[1181] | 74 | |
---|
| 75 | self.failUnless('actions_tabs_level' in IDropDownMenuSettings) |
---|
[3151] | 76 | self.assertEquals(self.registry[IPREFIX + 'actions_tabs_level'], 0) |
---|
[1181] | 77 | |
---|
| 78 | def test_actions_category(self): |
---|
| 79 | # Check actions_category record |
---|
[3153] | 80 | self.registry.records[IPREFIX + 'actions_category'] |
---|
[1181] | 81 | |
---|
| 82 | self.failUnless('actions_category' in IDropDownMenuSettings) |
---|
[3151] | 83 | self.assertEquals(self.registry[IPREFIX + 'actions_category'], |
---|
[1181] | 84 | u"portal_tabs") |
---|
| 85 | |
---|
| 86 | def test_nested_category_prefix(self): |
---|
| 87 | # Check nested_category_prefix record |
---|
[3153] | 88 | self.registry.records[IPREFIX + 'nested_category_prefix'] |
---|
[1181] | 89 | |
---|
| 90 | self.failUnless('nested_category_prefix' in IDropDownMenuSettings) |
---|
[3151] | 91 | self.assertEquals(self.registry[IPREFIX + 'nested_category_prefix'], |
---|
[1181] | 92 | u"") |
---|
| 93 | |
---|
| 94 | def test_nested_category_sufix(self): |
---|
| 95 | # Check nested_category_sufix record |
---|
[3153] | 96 | self.registry.records[IPREFIX + 'nested_category_sufix'] |
---|
[1181] | 97 | |
---|
| 98 | self.failUnless('nested_category_sufix' in IDropDownMenuSettings) |
---|
[3151] | 99 | self.assertEquals(self.registry[IPREFIX + 'nested_category_sufix'], |
---|
[1181] | 100 | u"_sub") |
---|
| 101 | |
---|
| 102 | |
---|
| 103 | def test_suite(): |
---|
| 104 | return unittest.defaultTestLoader.loadTestsFromName(__name__) |
---|