[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") |
---|
| 23 | self.failUnless('dropdownmenu' in [a.getAction(self)['id'] |
---|
| 24 | for a in self.controlpanel.listActions()]) |
---|
| 25 | |
---|
[1197] | 26 | def test_show_icons(self): |
---|
| 27 | # Check show_icons record |
---|
[3153] | 28 | self.registry.records[IPREFIX + 'show_icons'] |
---|
[1197] | 29 | |
---|
| 30 | self.failUnless('show_icons' in IDropDownMenuSettings) |
---|
[3151] | 31 | self.assertEquals(self.registry[IPREFIX + 'show_icons'], False) |
---|
[1197] | 32 | |
---|
[1181] | 33 | def test_show_content_tabs(self): |
---|
| 34 | # Check show_content_tabs record |
---|
[3153] | 35 | self.registry.records[IPREFIX + 'show_content_tabs'] |
---|
[1181] | 36 | |
---|
| 37 | self.failUnless('show_content_tabs' in IDropDownMenuSettings) |
---|
[3151] | 38 | self.assertEquals(self.registry[IPREFIX + 'show_content_tabs'], True) |
---|
[1181] | 39 | |
---|
| 40 | def test_show_nonfolderish_tabs(self): |
---|
| 41 | # Check show_nonfolderish_tabs record |
---|
[3153] | 42 | self.registry.records[IPREFIX + 'show_nonfolderish_tabs'] |
---|
[1181] | 43 | |
---|
| 44 | self.failUnless('show_nonfolderish_tabs' in IDropDownMenuSettings) |
---|
[3151] | 45 | self.assertEquals(self.registry[IPREFIX + 'show_nonfolderish_tabs'], |
---|
[1181] | 46 | True) |
---|
| 47 | |
---|
| 48 | def test_content_before_actions_tabs(self): |
---|
| 49 | # Check content_before_actions_tabs record |
---|
[3153] | 50 | self.registry.records[IPREFIX + 'content_before_actions_tabs'] |
---|
[1181] | 51 | |
---|
| 52 | self.failUnless('content_before_actions_tabs' in IDropDownMenuSettings) |
---|
[3151] | 53 | self.assertEquals(self.registry[ |
---|
| 54 | IPREFIX + 'content_before_actions_tabs'], False) |
---|
[1181] | 55 | |
---|
| 56 | def test_content_tabs_level(self): |
---|
| 57 | # Check content_tabs_level record |
---|
[3153] | 58 | self.registry.records[IPREFIX + 'content_tabs_level'] |
---|
[1181] | 59 | |
---|
| 60 | self.failUnless('content_tabs_level' in IDropDownMenuSettings) |
---|
[3151] | 61 | self.assertEquals(self.registry[IPREFIX + 'content_tabs_level'], 0) |
---|
[1181] | 62 | |
---|
| 63 | def test_show_actions_tabs(self): |
---|
| 64 | # Check show_actions_tabs record |
---|
[3153] | 65 | self.registry.records[IPREFIX + 'show_actions_tabs'] |
---|
[1181] | 66 | |
---|
| 67 | self.failUnless('show_actions_tabs' in IDropDownMenuSettings) |
---|
[3151] | 68 | self.assertEquals(self.registry[IPREFIX + 'show_actions_tabs'], True) |
---|
[1181] | 69 | |
---|
| 70 | def test_actions_tabs_level(self): |
---|
| 71 | # Check actions_tabs_level record |
---|
[3153] | 72 | self.registry.records[IPREFIX + 'actions_tabs_level'] |
---|
[1181] | 73 | |
---|
| 74 | self.failUnless('actions_tabs_level' in IDropDownMenuSettings) |
---|
[3151] | 75 | self.assertEquals(self.registry[IPREFIX + 'actions_tabs_level'], 0) |
---|
[1181] | 76 | |
---|
| 77 | def test_actions_category(self): |
---|
| 78 | # Check actions_category record |
---|
[3153] | 79 | self.registry.records[IPREFIX + 'actions_category'] |
---|
[1181] | 80 | |
---|
| 81 | self.failUnless('actions_category' in IDropDownMenuSettings) |
---|
[3151] | 82 | self.assertEquals(self.registry[IPREFIX + 'actions_category'], |
---|
[1181] | 83 | u"portal_tabs") |
---|
| 84 | |
---|
| 85 | def test_nested_category_prefix(self): |
---|
| 86 | # Check nested_category_prefix record |
---|
[3153] | 87 | self.registry.records[IPREFIX + 'nested_category_prefix'] |
---|
[1181] | 88 | |
---|
| 89 | self.failUnless('nested_category_prefix' in IDropDownMenuSettings) |
---|
[3151] | 90 | self.assertEquals(self.registry[IPREFIX + 'nested_category_prefix'], |
---|
[1181] | 91 | u"") |
---|
| 92 | |
---|
| 93 | def test_nested_category_sufix(self): |
---|
| 94 | # Check nested_category_sufix record |
---|
[3153] | 95 | self.registry.records[IPREFIX + 'nested_category_sufix'] |
---|
[1181] | 96 | |
---|
| 97 | self.failUnless('nested_category_sufix' in IDropDownMenuSettings) |
---|
[3151] | 98 | self.assertEquals(self.registry[IPREFIX + 'nested_category_sufix'], |
---|
[1181] | 99 | u"_sub") |
---|
| 100 | |
---|
| 101 | |
---|
| 102 | def test_suite(): |
---|
| 103 | return unittest.defaultTestLoader.loadTestsFromName(__name__) |
---|