Back to index

plone3  3.1.7
Public Member Functions
CMFPlone.tests.testMigrations.TestMigrations_v2_1_3 Class Reference
Inheritance diagram for CMFPlone.tests.testMigrations.TestMigrations_v2_1_3:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.tests.testMigrations.TestMigrations_v2_1_3:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def testNormalizeNavtreeProperties
def testNormalizeNavtreePropertiesTwice
def testNormalizeNavtreePropertiesNoTool
def testNormalizeNavtreePropertiesNoSheet
def testNormalizeNavtreePropertiesNoPropertyToRemove
def testNormalizeNavtreePropertiesNewPropertyExists
def testRemoveVcXMLRPC
def testRemoveVcXMLRPCTwice
def testRemoveVcXMLRPCNoTool
def testAddActionDropDownMenuIcons
def testAddActionDropDownMenuIconsTwice
def testAddActionDropDownMenuIconsNoTool
def removeActionFromTool
def removeActionIconFromTool
def addResourceToJSTool
def addResourceToCSSTool
def removeSiteProperty
def addSiteProperty
def removeNavTreeProperty
def addNavTreeProperty
def removeMemberdataProperty
def uninstallProduct
def addSkinLayer
def removeSkinLayer
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Detailed Description

Definition at line 510 of file testMigrations.py.


Member Function Documentation

def CMFPlone.tests.testMigrations.MigrationTest.addNavTreeProperty (   self,
  property_id 
) [inherited]

Definition at line 274 of file testMigrations.py.

00274 
00275     def addNavTreeProperty(self, property_id):
00276         # adds a navtree property to portal_properties
00277         tool = getattr(self.portal, 'portal_properties')
00278         sheet = getattr(tool, 'navtree_properties')
00279         if not sheet.hasProperty(property_id):
00280             sheet.manage_addProperty(property_id,[],'lines')

Here is the call graph for this function:

def CMFPlone.tests.testMigrations.MigrationTest.addResourceToCSSTool (   self,
  resource_name 
) [inherited]

Definition at line 247 of file testMigrations.py.

00247 
00248     def addResourceToCSSTool(self, resource_name):
00249         # Registers a resource with the css tool
00250         tool = getattr(self.portal, 'portal_css')
00251         if not resource_name in tool.getResourceIds():
00252             tool.registerStylesheet(resource_name)

Here is the call graph for this function:

def CMFPlone.tests.testMigrations.MigrationTest.addResourceToJSTool (   self,
  resource_name 
) [inherited]

Definition at line 241 of file testMigrations.py.

00241 
00242     def addResourceToJSTool(self, resource_name):
00243         # Registers a resource with the javascripts tool
00244         tool = getattr(self.portal, 'portal_javascripts')
00245         if not resource_name in tool.getResourceIds():
00246             tool.registerScript(resource_name)

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.testMigrations.MigrationTest.addSiteProperty (   self,
  property_id 
) [inherited]

Definition at line 260 of file testMigrations.py.

00260 
00261     def addSiteProperty(self, property_id):
00262         # adds a site property to portal_properties
00263         tool = getattr(self.portal, 'portal_properties')
00264         sheet = getattr(tool, 'site_properties')
00265         if not sheet.hasProperty(property_id):
00266             sheet.manage_addProperty(property_id,[],'lines')

Here is the call graph for this function:

def CMFPlone.tests.testMigrations.MigrationTest.addSkinLayer (   self,
  layer,
  skin = 'Plone Default',
  pos = None 
) [inherited]

Definition at line 293 of file testMigrations.py.

00293 
00294     def addSkinLayer(self, layer, skin='Plone Default', pos=None):
00295         # Adds a skin layer at pos. If pos is None, the layer is appended
00296         path = self.skins.getSkinPath(skin)
00297         path = [x.strip() for x in path.split(',')]
00298         if layer in path:
00299             path.remove(layer)
00300         if pos is None:
00301             path.append(layer)
00302         else:
00303             path.insert(pos, layer)
00304         self.skins.addSkinSelection(skin, ','.join(path))

Here is the caller graph for this function:

Definition at line 30 of file PloneTestCase.py.

00030 
00031     def getAuthenticator(self):
00032         tag = AuthenticatorView('context', 'request').authenticator()
00033         pattern = '<input .*name="(\w+)".*value="(\w+)"'
00034         return match(pattern, tag).groups()

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.testMigrations.MigrationTest.removeActionFromTool (   self,
  action_id,
  category = None,
  action_provider = 'portal_actions' 
) [inherited]

Definition at line 222 of file testMigrations.py.

00222 
00223     def removeActionFromTool(self, action_id, category=None, action_provider='portal_actions'):
00224         # Removes an action from portal_actions
00225         tool = getattr(self.portal, action_provider)
00226         if category is None:
00227             if action_id in tool.objectIds() and IActionInfo.providedBy(tool._getOb(action_id)):
00228                 tool._delOb(action_id)
00229         else:
00230             if category in tool.objectIds() and IActionCategory.providedBy(tool._getOb(category)):
00231                 if action_id in tool.objectIds() and IActionInfo.providedBy(tool._getOb(action_id)):
00232                     tool._delOb(action_id)

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.testMigrations.MigrationTest.removeActionIconFromTool (   self,
  action_id,
  category = 'plone' 
) [inherited]

Definition at line 233 of file testMigrations.py.

00233 
00234     def removeActionIconFromTool(self, action_id, category='plone'):
00235         # Removes an action icon from portal_actionicons
00236         tool = getattr(self.portal, 'portal_actionicons')
00237         try:
00238             tool.removeActionIcon(category, action_id)
00239         except KeyError:
00240             pass # No icon associated

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.testMigrations.MigrationTest.removeMemberdataProperty (   self,
  property_id 
) [inherited]

Definition at line 281 of file testMigrations.py.

00281 
00282     def removeMemberdataProperty(self, property_id):
00283         # Removes a memberdata property from portal_memberdata
00284         tool = getattr(self.portal, 'portal_memberdata')
00285         if tool.hasProperty(property_id):
00286             tool.manage_delProperties([property_id])

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.testMigrations.MigrationTest.removeNavTreeProperty (   self,
  property_id 
) [inherited]

Definition at line 267 of file testMigrations.py.

00267 
00268     def removeNavTreeProperty(self, property_id):
00269         # Removes a navtree property from portal_properties
00270         tool = getattr(self.portal, 'portal_properties')
00271         sheet = getattr(tool, 'navtree_properties')
00272         if sheet.hasProperty(property_id):
00273             sheet.manage_delProperties([property_id])

Here is the call graph for this function:

def CMFPlone.tests.testMigrations.MigrationTest.removeSiteProperty (   self,
  property_id 
) [inherited]

Definition at line 253 of file testMigrations.py.

00253 
00254     def removeSiteProperty(self, property_id):
00255         # Removes a site property from portal_properties
00256         tool = getattr(self.portal, 'portal_properties')
00257         sheet = getattr(tool, 'site_properties')
00258         if sheet.hasProperty(property_id):
00259             sheet.manage_delProperties([property_id])

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.testMigrations.MigrationTest.removeSkinLayer (   self,
  layer,
  skin = 'Plone Default' 
) [inherited]

Definition at line 305 of file testMigrations.py.

00305 
00306     def removeSkinLayer(self, layer, skin='Plone Default'):
00307         # Removes a skin layer from skin
00308         path = self.skins.getSkinPath(skin)
00309         path = [x.strip() for x in path.split(',')]
00310         if layer in path:
00311             path.remove(layer)
00312             self.skins.addSkinSelection(skin, ','.join(path))
00313 

Here is the caller graph for this function:

def CMFPlone.tests.PloneTestCase.PloneTestCase.setRequestMethod (   self,
  method 
) [inherited]
This is a stub now, but in case you want to try
   something fancy on Your Branch (tm), put it here.

Definition at line 26 of file PloneTestCase.py.

00026 
00027     def setRequestMethod(self, method):
00028         self.app.REQUEST.set('REQUEST_METHOD', method)
00029         self.app.REQUEST.method = method

Here is the caller graph for this function:

Definition at line 35 of file PloneTestCase.py.

00035 
00036     def setupAuthenticator(self):
00037         name, token = self.getAuthenticator()
00038         self.app.REQUEST.form[name] = token
00039 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 595 of file testMigrations.py.

00595 
00596     def testAddActionDropDownMenuIcons(self):
00597         # Should add icons to object buttons
00598         self.removeActionIconFromTool('cut', 'object_buttons')
00599         self.removeActionIconFromTool('copy', 'object_buttons')
00600         self.removeActionIconFromTool('paste', 'object_buttons')
00601         self.removeActionIconFromTool('delete', 'object_buttons')
00602         addActionDropDownMenuIcons(self.portal, [])
00603         ai=self.portal.portal_actionicons
00604         icons = dict([
00605             ((x.getCategory(), x.getActionId()), x)
00606             for x in ai.listActionIcons()
00607         ])
00608         self.failIf(('object_buttons', 'cut') not in icons)
00609         self.failIf(('object_buttons', 'copy') not in icons)
00610         self.failIf(('object_buttons', 'paste') not in icons)
00611         self.failIf(('object_buttons', 'delete') not in icons)
00612         self.assertEqual(icons[('object_buttons', 'cut')].getExpression(), 'cut_icon.gif')
00613         self.assertEqual(icons[('object_buttons', 'copy')].getExpression(), 'copy_icon.gif')
00614         self.assertEqual(icons[('object_buttons', 'paste')].getExpression(), 'paste_icon.gif')
00615         self.assertEqual(icons[('object_buttons', 'delete')].getExpression(), 'delete_icon.gif')
00616         self.assertEqual(icons[('object_buttons', 'cut')].getTitle(), 'Cut')
00617         self.assertEqual(icons[('object_buttons', 'copy')].getTitle(), 'Copy')
00618         self.assertEqual(icons[('object_buttons', 'paste')].getTitle(), 'Paste')
00619         self.assertEqual(icons[('object_buttons', 'delete')].getTitle(), 'Delete')

Here is the call graph for this function:

Definition at line 646 of file testMigrations.py.

00646 
00647     def testAddActionDropDownMenuIconsNoTool(self):
00648         # Should not break if actionicons tool is missing
00649         self.portal._delObject('portal_actionicons')
00650         addActionDropDownMenuIcons(self.portal, [])
00651 

Here is the call graph for this function:

Definition at line 620 of file testMigrations.py.

00620 
00621     def testAddActionDropDownMenuIconsTwice(self):
00622         # Should not fail if migrated again
00623         self.removeActionIconFromTool('cut', 'object_buttons')
00624         self.removeActionIconFromTool('copy', 'object_buttons')
00625         self.removeActionIconFromTool('paste', 'object_buttons')
00626         self.removeActionIconFromTool('delete', 'object_buttons')
00627         addActionDropDownMenuIcons(self.portal, [])
00628         addActionDropDownMenuIcons(self.portal, [])
00629         ai=self.portal.portal_actionicons
00630         icons = dict([
00631             ((x.getCategory(), x.getActionId()), x)
00632             for x in ai.listActionIcons()
00633         ])
00634         self.failIf(('object_buttons', 'cut') not in icons)
00635         self.failIf(('object_buttons', 'copy') not in icons)
00636         self.failIf(('object_buttons', 'paste') not in icons)
00637         self.failIf(('object_buttons', 'delete') not in icons)
00638         self.assertEqual(icons[('object_buttons', 'cut')].getExpression(), 'cut_icon.gif')
00639         self.assertEqual(icons[('object_buttons', 'copy')].getExpression(), 'copy_icon.gif')
00640         self.assertEqual(icons[('object_buttons', 'paste')].getExpression(), 'paste_icon.gif')
00641         self.assertEqual(icons[('object_buttons', 'delete')].getExpression(), 'delete_icon.gif')
00642         self.assertEqual(icons[('object_buttons', 'cut')].getTitle(), 'Cut')
00643         self.assertEqual(icons[('object_buttons', 'copy')].getTitle(), 'Copy')
00644         self.assertEqual(icons[('object_buttons', 'paste')].getTitle(), 'Paste')
00645         self.assertEqual(icons[('object_buttons', 'delete')].getTitle(), 'Delete')

Here is the call graph for this function:

Definition at line 512 of file testMigrations.py.

00512 
00513     def testNormalizeNavtreeProperties(self):
00514         ntp = self.portal.portal_properties.navtree_properties
00515         toRemove = ['skipIndex_html', 'showMyUserFolderOnly', 'showFolderishSiblingsOnly',
00516                     'showFolderishChildrenOnly', 'showNonFolderishObject', 'showTopicResults',
00517                     'rolesSeeContentView', 'rolesSeeUnpublishedContent', 'batchSize',
00518                     'croppingLength', 'forceParentsInBatch', 'rolesSeeHiddenContent', 'typesLinkToFolderContents']
00519         toAdd = {'name' : '', 'root' : '/', 'currentFolderOnlyInNavtree' : False}
00520         for property in toRemove:
00521             ntp._setProperty(property, 'X', 'string')
00522         for property, value in toAdd.items():
00523             ntp._delProperty(property)
00524         ntp.manage_changeProperties(bottomLevel = 65535)
00525         normalizeNavtreeProperties(self.portal, [])
00526         for property in toRemove:
00527             self.assertEqual(ntp.getProperty(property, None), None)
00528         for property, value in toAdd.items():
00529             self.assertEqual(ntp.getProperty(property), value)
00530         self.assertEqual(ntp.getProperty('bottomLevel'), 0)

Here is the call graph for this function:

Definition at line 566 of file testMigrations.py.

00566 
00567     def testNormalizeNavtreePropertiesNewPropertyExists(self):
00568         ntp = self.portal.portal_properties.navtree_properties
00569         ntp.manage_changeProperties(root = '/foo', bottomLevel = 10)
00570         normalizeNavtreeProperties(self.portal, [])
00571         self.assertEqual(ntp.getProperty('root'), '/foo')
00572         self.assertEqual(ntp.getProperty('bottomLevel'), 10)

Here is the call graph for this function:

Definition at line 560 of file testMigrations.py.

00560 
00561     def testNormalizeNavtreePropertiesNoPropertyToRemove(self):
00562         ntp = self.portal.portal_properties.navtree_properties
00563         if ntp.getProperty('skipIndex_html', None) is not None:
00564             ntp._delProperty('skipIndex_html')
00565         normalizeNavtreeProperties(self.portal, [])

Here is the call graph for this function:

Definition at line 556 of file testMigrations.py.

00556 
00557     def testNormalizeNavtreePropertiesNoSheet(self):
00558         self.portal.portal_properties._delObject('navtree_properties')
00559         normalizeNavtreeProperties(self.portal, [])

Here is the call graph for this function:

Definition at line 552 of file testMigrations.py.

00552 
00553     def testNormalizeNavtreePropertiesNoTool(self):
00554         self.portal._delObject('portal_properties')
00555         normalizeNavtreeProperties(self.portal, [])

Here is the call graph for this function:

Definition at line 531 of file testMigrations.py.

00531 
00532     def testNormalizeNavtreePropertiesTwice(self):
00533         ntp = self.portal.portal_properties.navtree_properties
00534         toRemove = ['skipIndex_html', 'showMyUserFolderOnly', 'showFolderishSiblingsOnly',
00535                     'showFolderishChildrenOnly', 'showNonFolderishObject', 'showTopicResults',
00536                     'rolesSeeContentView', 'rolesSeeUnpublishedContent', 'rolesSeeContentsView',
00537                     'batchSize', 'sortCriteria', 'croppingLength', 'forceParentsInBatch',
00538                     'rolesSeeHiddenContent', 'typesLinkToFolderContents']
00539         toAdd = {'name' : '', 'root' : '/', 'currentFolderOnlyInNavtree' : False}
00540         for property in toRemove:
00541             ntp._setProperty(property, 'X', 'string')
00542         for property, value in toAdd.items():
00543             ntp._delProperty(property)
00544         ntp.manage_changeProperties(bottomLevel = 65535)
00545         normalizeNavtreeProperties(self.portal, [])
00546         normalizeNavtreeProperties(self.portal, [])
00547         for property in toRemove:
00548             self.assertEqual(ntp.getProperty(property, None), None)
00549         for property, value in toAdd.items():
00550             self.assertEqual(ntp.getProperty(property), value)
00551         self.assertEqual(ntp.getProperty('bottomLevel'), 0)

Here is the call graph for this function:

Definition at line 573 of file testMigrations.py.

00573 
00574     def testRemoveVcXMLRPC(self):
00575         # Should unregister vcXMLRPC.js
00576         self.addResourceToJSTool('vcXMLRPC.js')
00577         removeVcXMLRPC(self.portal, [])
00578         jsreg = self.portal.portal_javascripts
00579         script_ids = jsreg.getResourceIds()
00580         self.failIf('vcXMLRPC.js' in script_ids)

Here is the call graph for this function:

Definition at line 590 of file testMigrations.py.

00590 
00591     def testRemoveVcXMLRPCNoTool(self):
00592         # Should not break if javascripts tool is missing
00593         self.portal._delObject('portal_javascripts')
00594         removeVcXMLRPC(self.portal, [])

Here is the call graph for this function:

Definition at line 581 of file testMigrations.py.

00581 
00582     def testRemoveVcXMLRPCTwice(self):
00583         # Should not fail if migrated again
00584         self.addResourceToJSTool('vcXMLRPC.js')
00585         removeVcXMLRPC(self.portal, [])
00586         removeVcXMLRPC(self.portal, [])
00587         jsreg = self.portal.portal_javascripts
00588         script_ids = jsreg.getResourceIds()
00589         self.failIf('vcXMLRPC.js' in script_ids)

Here is the call graph for this function:

def CMFPlone.tests.testMigrations.MigrationTest.uninstallProduct (   self,
  product_name 
) [inherited]

Definition at line 287 of file testMigrations.py.

00287 
00288     def uninstallProduct(self, product_name):
00289         # Removes a product
00290         tool = getattr(self.portal, 'portal_quickinstaller')
00291         if tool.isProductInstalled(product_name):
00292             tool.uninstallProducts([product_name])

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: