Changeset 3151 in products for quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/tests
- Timestamp:
- Apr 20, 2011 8:15:52 AM (13 years ago)
- Location:
- quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/tests
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/tests/base.py
r2875 r3151 20 20 #ptc.setupPloneSite() 21 21 22 22 23 class NotInstalled(BasePTCLayer): 23 24 """Initialize the package, without installation into portal … … 30 31 ztc.installPackage(PROJECT_NAME) 31 32 33 32 34 class Installed(BasePTCLayer): 33 35 """ Install product into the portal … … 35 37 def afterSetUp(self): 36 38 self.addProduct(PROJECT_NAME) 39 37 40 38 41 class UnInstalled(BasePTCLayer): … … 44 47 try: 45 48 qi = self.portal.portal_quickinstaller 46 qi.uninstallProducts(products=[PROJECT_NAME, ])49 qi.uninstallProducts(products=[PROJECT_NAME, ]) 47 50 #self._refreshSkinData() 48 51 finally: 49 52 setSecurityManager(sm) 50 53 51 NotInstalledLayer = NotInstalled([ptc_layer, ])52 InstalledLayer = Installed([NotInstalledLayer, ])53 UnInstalledLayer = UnInstalled([InstalledLayer, ])54 NotInstalledLayer = NotInstalled([ptc_layer, ]) 55 InstalledLayer = Installed([NotInstalledLayer, ]) 56 UnInstalledLayer = UnInstalled([InstalledLayer, ]) 54 57 55 58 56 59 class TestCaseNotInstalled(ptc.PloneTestCase): 57 60 layer = NotInstalledLayer 61 58 62 59 63 class TestCase(ptc.PloneTestCase): … … 65 69 alsoProvides(self.app.REQUEST, IDropDownMenuLayer) 66 70 71 67 72 class TestCaseUnInstalled(ptc.PloneTestCase): 68 73 layer = UnInstalledLayer … … 71 76 class FunctionalTestCaseNotInstalled(ptc.FunctionalTestCase): 72 77 layer = NotInstalledLayer 78 73 79 74 80 class FunctionalTestCase(ptc.FunctionalTestCase): … … 80 86 alsoProvides(self.app.REQUEST, IDropDownMenuLayer) 81 87 88 82 89 class FunctionalTestCaseUnInstalled(ptc.FunctionalTestCase): 83 90 layer = UnInstalledLayer -
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/tests/test_controlpanel.py
r2875 r3151 6 6 7 7 from quintagroup.dropdownmenu.interfaces import IDropDownMenuSettings 8 8 9 9 10 class RegistryTest(TestCase): … … 23 24 def test_show_icons(self): 24 25 # Check show_icons record 25 show_icons = self.registry.records[IPREFIX +'show_icons']26 show_icons = self.registry.records[IPREFIX + 'show_icons'] 26 27 27 28 self.failUnless('show_icons' in IDropDownMenuSettings) 28 self.assertEquals(self.registry[IPREFIX +'show_icons'], False)29 self.assertEquals(self.registry[IPREFIX + 'show_icons'], False) 29 30 30 31 def test_show_content_tabs(self): 31 32 # Check show_content_tabs record 32 show_content_tabs = self.registry.records[IPREFIX+'show_content_tabs'] 33 show_content_tabs = self.registry.records[ 34 IPREFIX + 'show_content_tabs'] 33 35 34 36 self.failUnless('show_content_tabs' in IDropDownMenuSettings) 35 self.assertEquals(self.registry[IPREFIX +'show_content_tabs'], True)37 self.assertEquals(self.registry[IPREFIX + 'show_content_tabs'], True) 36 38 37 39 def test_show_nonfolderish_tabs(self): 38 40 # Check show_nonfolderish_tabs record 39 41 show_nonfolderish_tabs = self.registry.records[ 40 IPREFIX +'show_nonfolderish_tabs']42 IPREFIX + 'show_nonfolderish_tabs'] 41 43 42 44 self.failUnless('show_nonfolderish_tabs' in IDropDownMenuSettings) 43 self.assertEquals(self.registry[IPREFIX +'show_nonfolderish_tabs'],45 self.assertEquals(self.registry[IPREFIX + 'show_nonfolderish_tabs'], 44 46 True) 45 47 … … 47 49 # Check content_before_actions_tabs record 48 50 content_before_actions_tabs = self.registry.records[ 49 IPREFIX +'content_before_actions_tabs']51 IPREFIX + 'content_before_actions_tabs'] 50 52 51 53 self.failUnless('content_before_actions_tabs' in IDropDownMenuSettings) 52 self.assertEquals(self.registry[ IPREFIX+'content_before_actions_tabs'],53 54 self.assertEquals(self.registry[ 55 IPREFIX + 'content_before_actions_tabs'], False) 54 56 55 57 def test_content_tabs_level(self): 56 58 # Check content_tabs_level record 57 content_tabs_level = self.registry.records[IPREFIX+'content_tabs_level'] 59 content_tabs_level = self.registry.records[ 60 IPREFIX + 'content_tabs_level'] 58 61 59 62 self.failUnless('content_tabs_level' in IDropDownMenuSettings) 60 self.assertEquals(self.registry[IPREFIX +'content_tabs_level'], 0)63 self.assertEquals(self.registry[IPREFIX + 'content_tabs_level'], 0) 61 64 62 65 def test_show_actions_tabs(self): 63 66 # Check show_actions_tabs record 64 show_actions_tabs = self.registry.records[IPREFIX+'show_actions_tabs'] 67 show_actions_tabs = self.registry.records[ 68 IPREFIX + 'show_actions_tabs'] 65 69 66 70 self.failUnless('show_actions_tabs' in IDropDownMenuSettings) 67 self.assertEquals(self.registry[IPREFIX +'show_actions_tabs'], True)71 self.assertEquals(self.registry[IPREFIX + 'show_actions_tabs'], True) 68 72 69 73 def test_actions_tabs_level(self): 70 74 # Check actions_tabs_level record 71 actions_tabs_level = self.registry.records[IPREFIX+'actions_tabs_level'] 75 actions_tabs_level = self.registry.records[ 76 IPREFIX + 'actions_tabs_level'] 72 77 73 78 self.failUnless('actions_tabs_level' in IDropDownMenuSettings) 74 self.assertEquals(self.registry[IPREFIX +'actions_tabs_level'], 0)79 self.assertEquals(self.registry[IPREFIX + 'actions_tabs_level'], 0) 75 80 76 81 def test_actions_category(self): 77 82 # Check actions_category record 78 actions_category = self.registry.records[IPREFIX +'actions_category']83 actions_category = self.registry.records[IPREFIX + 'actions_category'] 79 84 80 85 self.failUnless('actions_category' in IDropDownMenuSettings) 81 self.assertEquals(self.registry[IPREFIX +'actions_category'],86 self.assertEquals(self.registry[IPREFIX + 'actions_category'], 82 87 u"portal_tabs") 83 88 … … 85 90 # Check nested_category_prefix record 86 91 nested_category_prefix = self.registry.records[ 87 IPREFIX +'nested_category_prefix']92 IPREFIX + 'nested_category_prefix'] 88 93 89 94 self.failUnless('nested_category_prefix' in IDropDownMenuSettings) 90 self.assertEquals(self.registry[IPREFIX +'nested_category_prefix'],95 self.assertEquals(self.registry[IPREFIX + 'nested_category_prefix'], 91 96 u"") 92 97 … … 94 99 # Check nested_category_sufix record 95 100 nested_category_sufix = self.registry.records[ 96 IPREFIX +'nested_category_sufix']101 IPREFIX + 'nested_category_sufix'] 97 102 98 103 self.failUnless('nested_category_sufix' in IDropDownMenuSettings) 99 self.assertEquals(self.registry[IPREFIX +'nested_category_sufix'],104 self.assertEquals(self.registry[IPREFIX + 'nested_category_sufix'], 100 105 u"_sub") 101 106 -
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/tests/test_docs.py
r2872 r3151 5 5 #from zope.component import testing 6 6 from base import TestCase, ztc 7 7 8 8 9 def test_suite(): -
quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/tests/test_installation.py
r2874 r3151 10 10 11 11 from base import * 12 CSS_RESOURCES = ["++resource++drop_down.css",] 13 DEPENDENCIES = ["plone.app.registry",] 14 CONFIGLETS = ["dropdownmenu",] 15 #REGISTRY_INTERFACE = "quintagroup.dropdownmenu.interfaces.IDropDownMenuSettings" 12 CSS_RESOURCES = ["++resource++drop_down.css", ] 13 DEPENDENCIES = ["plone.app.registry", ] 14 CONFIGLETS = ["dropdownmenu", ] 15 #REGISTRY_INTERFACE="quintagroup.dropdownmenu.interfaces.IDropDownMenuSettings" 16 16 17 17 18 class TestInstallation(TestCase): … … 24 25 def testInstalledDependencies(self): 25 26 cp = self.portal.portal_controlpanel 26 configlets = [ai['id'] for ai in cp.listActionInfos(check_permissions=0)] 27 self.assertTrue([1 for ai in configlets if ai=="plone.app.registry"], 27 configlets = [ai['id'] for ai in cp.listActionInfos( 28 check_permissions=0)] 29 self.assertTrue([1 for ai in configlets if ai == "plone.app.registry"], 28 30 'Not installed required plone.app.registry product.') 29 31 … … 36 38 def testConfiglet(self): 37 39 cp = self.portal.portal_controlpanel 38 configlets = [ai['id'] for ai in cp.listActionInfos(check_permissions=0)] 40 configlets = [ai['id'] for ai in cp.listActionInfos( 41 check_permissions=0)] 39 42 for cid in CONFIGLETS: 40 self.assertTrue([1 for ai in configlets if ai ==cid],43 self.assertTrue([1 for ai in configlets if ai == cid], 41 44 'No "%s" configlet added to plone control panel' % cid) 42 45 … … 48 51 registry = queryUtility(IRegistry) 49 52 afield = "show_content_tabs" 50 self.assertTrue(registry.records.get(IPREFIX +afield, None),53 self.assertTrue(registry.records.get(IPREFIX + afield, None), 51 54 "Not registered '%s' registry interface" % IPREFIX) 55 52 56 53 57 class TestUninstallation(TestCaseUnInstalled): … … 66 70 def testConfiglet(self): 67 71 cp = self.portal.portal_controlpanel 68 configlets = [ai['id'] for ai in cp.listActionInfos(check_permissions=0)] 72 configlets = [ai['id'] for ai in cp.listActionInfos( 73 check_permissions=0)] 69 74 for cid in CONFIGLETS: 70 self.assertFalse([1 for ai in configlets if ai==cid], 71 '"%s" configlet not uninstalled from plone control panel' % cid) 75 self.assertFalse([1 for ai in configlets if ai == cid], 76 '"%s" configlet not uninstalled '\ 77 'from plone control panel' % cid) 72 78 73 79 def testBrowserLayer(self): … … 78 84 registry = queryUtility(IRegistry) 79 85 afield = "show_content_tabs" 80 self.assertFalse(registry.records.get(IPREFIX +afield, None),86 self.assertFalse(registry.records.get(IPREFIX + afield, None), 81 87 "Not unregistered '%s' registry interface" % IPREFIX) 82 88
Note: See TracChangeset
for help on using the changeset viewer.