Changeset 2488


Ignore:
Timestamp:
11/16/07 17:56:44 (8 years ago)
Author:
cxe5014@…
Message:

added a bit to install/uninstall scripts to hide or unhide the relations tab action. It does nothing useful for us, and exposes to users things we don't want them to be able to touch. Also added tests to verify that this bit is working.

Additionally, added the testReinstall tests into the test suite, so that they'd actually run. For some reason they weren't in there.

fixes #400

Location:
weblion/FacultyStaffDirectory/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • weblion/FacultyStaffDirectory/trunk/Extensions/AppInstall.py

    r2451 r2488  
    147147            action.visible = False 
    148148 
     149    # if plone 2.5 or less, massage the relations_library tool to make the relations tab invisible (tab is not present in 3.0, so np) 
     150    if not isPlone3OrBetter: 
     151        rl = getToolByName(self, 'relations_library') 
     152        currentActions = rl.listActions() 
     153        for action in currentActions: 
     154            if action.id == 'relations': 
     155                action.visible = False 
    149156 
    150157    # Register a configlet to control some behaviors of the product: 
     
    286293            cp.deleteActions([index]) 
    287294        index += 1 
     295 
     296    # if plone 2.5 or less, massage the relations_library tool to turn relations tab back on 
     297    if not isPlone3OrBetter: 
     298        rl = getToolByName(self, 'relations_library') 
     299        currentActions = rl.listActions() 
     300        for action in currentActions: 
     301            if action.id == 'relations': 
     302                action.visible = True 
    288303             
    289304             
  • weblion/FacultyStaffDirectory/trunk/tests/testInstall.py

    r2451 r2488  
    5050                hasfsdmemberprofile = True 
    5151        self.failUnless(hasfsdmemberprofile, "New MemberPrefs action failed to install.") 
     52         
     53    def testRelationsTabInvisible(self): 
     54        if not self.isPlone3OrBetter: 
     55            rl = getToolByName(self.portal, 'relations_library') 
     56            actions = rl.listActions() 
     57            for action in actions: 
     58                if action.id == 'relations': 
     59                    self.failIf(action.visible, "relations action is still visible") 
     60        else: 
     61            pass 
    5262 
    5363    def testPortalSetupImportWorks(self): 
     
    91101        self.failIf(hasfsdmemberprofile, "new MemberPrefs action failed to uninstall") 
    92102         
     103    def testRelationsTabVisible(self): 
     104        if not self.isPlone3OrBetter: 
     105            rl = getToolByName(self.portal, 'relations_library') 
     106            actions = rl.listActions() 
     107            for action in actions: 
     108                if action.id == 'relations': 
     109                    self.failUnless(action.visible, "relations action is not visible after uninstall") 
     110        else: 
     111            pass 
     112         
    93113 
    94114class testReinstall(testPlone): 
    95115    def afterSetUp(self): 
     116        migrationTool = getToolByName(self.portal, 'portal_migration') 
     117        self.isPlone3OrBetter = migrationTool.getInstanceVersion() >= '3.0' 
    96118        self.loginAsPortalOwner() 
    97119        self.directory = self.getPopulatedDirectory() 
     
    112134        self.failUnless(acl.getUserById(id='abc123')) 
    113135         
     136    def testRelationsTabInvisible(self): 
     137        if not self.isPlone3OrBetter: 
     138            rl = getToolByName(self.portal, 'relations_library') 
     139            actions = rl.listActions() 
     140            for action in actions: 
     141                if action.id == 'relations': 
     142                    self.failIf(action.visible, "relations action made visible by reinstall") 
     143        else: 
     144            pass 
     145         
    114146def test_suite(): 
    115147    from unittest import TestSuite, makeSuite 
     
    117149    suite.addTest(makeSuite(testInstall)) 
    118150    suite.addTest(makeSuite(testUninstall)) 
     151    suite.addTest(makeSuite(testReinstall)) 
    119152    return suite 
    120153                 
Note: See TracChangeset for help on using the changeset viewer.