Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def testMigrateActions
def testMigrateActionsTwice
def testUpdateActionsI18NDomain
def testUpdateActionsI18NDomainTwice
def testUpdateActionsI18NDomainNonAscii
def testHistoryActionID
def testHistoryActionIDTwice
def testProviderCleanup
def testRemovePropertiesActions
def beforeTearDown
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

Public Attributes

 actions
 types
 workflow
 reply
 discussion

Detailed Description

Definition at line 1193 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 1195 of file testMigrations.py.

01195 
01196     def afterSetUp(self):
01197         self.actions = self.portal.portal_actions
01198         self.types = self.portal.portal_types
01199         self.workflow = self.portal.portal_workflow
01200         
01201         # Create dummy old ActionInformation
01202         self.reply = ActionInformation('reply',
01203             title='Reply',
01204             category='reply_actions',
01205             condition='context/replyAllowed',
01206             permissions=(AccessInactivePortalContent, ),
01207             priority=10,
01208             visible=True,
01209             action='context/reply'
01210         )
01211         self.discussion = self.portal.portal_discussion
01212         self.discussion._actions = (self.reply, )

Definition at line 1318 of file testMigrations.py.

01318 
01319     def beforeTearDown(self):
01320         if len(self.discussion._actions) > 0:
01321             self.discussion._actions = ()
01322 

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 1290 of file testMigrations.py.

01290 
01291     def testHistoryActionID(self):
01292         migrateHistoryTab(self.portal, [])
01293         objects = getattr(self.actions, 'object', None)
01294         self.failIf('rss' in objects.objectIds())

Here is the call graph for this function:

Definition at line 1295 of file testMigrations.py.

01295 
01296     def testHistoryActionIDTwice(self):
01297         migrateHistoryTab(self.portal, [])
01298         migrateHistoryTab(self.portal, [])
01299         objects = getattr(self.actions, 'object', None)
01300         self.failIf('rss' in objects.objectIds())
01301 

Here is the call graph for this function:

Definition at line 1213 of file testMigrations.py.

01213 
01214     def testMigrateActions(self):
01215         self.failUnless(self.discussion._actions == (self.reply, ))
01216         
01217         migrateOldActions(self.portal, [])
01218 
01219         reply_actions = getattr(self.actions, 'reply_actions', None)
01220         self.failIf(reply_actions is None)
01221         reply = getattr(reply_actions, 'reply', None)
01222         self.failIf(reply is None)
01223         self.failUnless(isinstance(reply, Action))
01224 
01225         # Verify all data has been migrated correctly to the new Action
01226         data = reply.getInfoData()[0]
01227         self.assertEquals(data['category'], 'reply_actions')
01228         self.assertEquals(data['title'], 'Reply')
01229         self.assertEquals(data['visible'], True)
01230         self.assertEquals(data['permissions'], (AccessInactivePortalContent, ))
01231         self.assertEquals(data['available'].text, 'context/replyAllowed')
01232         self.assertEquals(data['url'].text, 'context/reply')
01233 
01234         # Make sure the original action has been removed
01235         self.failUnless(len(self.discussion._actions) == 0)

Here is the call graph for this function:

Definition at line 1236 of file testMigrations.py.

01236 
01237     def testMigrateActionsTwice(self):
01238         self.failUnless(self.discussion._actions == (self.reply, ))
01239 
01240         migrateOldActions(self.portal, [])
01241         migrateOldActions(self.portal, [])
01242 
01243         reply_actions = getattr(self.actions, 'reply_actions', None)
01244         self.failIf(reply_actions is None)
01245         reply = getattr(reply_actions, 'reply', None)
01246         self.failIf(reply is None)
01247         self.failUnless(isinstance(reply, Action))
01248 
01249         # Verify all data has been migrated correctly to the new Action
01250         data = reply.getInfoData()[0]
01251         self.assertEquals(data['category'], 'reply_actions')
01252         self.assertEquals(data['title'], 'Reply')
01253         self.assertEquals(data['visible'], True)
01254         self.assertEquals(data['permissions'], (AccessInactivePortalContent, ))
01255         self.assertEquals(data['available'].text, 'context/replyAllowed')
01256         self.assertEquals(data['url'].text, 'context/reply')
01257 
01258         # Make sure the original action has been removed
01259         self.failUnless(len(self.discussion._actions) == 0)

Here is the call graph for this function:

Definition at line 1302 of file testMigrations.py.

01302 
01303     def testProviderCleanup(self):
01304         self.actions.addActionProvider("portal_membership")
01305         self.failUnless("portal_membership" in self.actions.listActionProviders())
01306         cleanupActionProviders(self.portal, [])
01307         self.failIf("portal_membership" in self.actions.listActionProviders())
01308 

Here is the call graph for this function:

Definition at line 1309 of file testMigrations.py.

01309 
01310     def testRemovePropertiesActions(self):
01311         ti=self.types.getTypeInfo("Document")
01312         if ti.getActionObject("object/properties") is None:
01313             ti.addAction("metadata", "name", "action", "condition",
01314                     "permission", "object",)
01315         hidePropertiesAction(self.portal, [])
01316         self.failUnless(ti.getActionObject("object/metadata") is None)
01317 

Here is the call graph for this function:

Definition at line 1260 of file testMigrations.py.

01260 
01261     def testUpdateActionsI18NDomain(self):
01262         migrateOldActions(self.portal, [])
01263         reply = self.actions.reply_actions.reply
01264         self.assertEquals(reply.i18n_domain, '')
01265 
01266         updateActionsI18NDomain(self.portal, [])
01267         
01268         self.assertEquals(reply.i18n_domain, 'plone')

Here is the call graph for this function:

Definition at line 1279 of file testMigrations.py.

01279 
01280     def testUpdateActionsI18NDomainNonAscii(self):
01281         migrateOldActions(self.portal, [])
01282         reply = self.actions.reply_actions.reply
01283         reply.title = 'Foo\xc3'
01284         self.assertEquals(reply.i18n_domain, '')
01285         self.assertEquals(reply.title, 'Foo\xc3')
01286 
01287         updateActionsI18NDomain(self.portal, [])
01288         
01289         self.assertEquals(reply.i18n_domain, '')

Here is the call graph for this function:

Definition at line 1269 of file testMigrations.py.

01269 
01270     def testUpdateActionsI18NDomainTwice(self):
01271         migrateOldActions(self.portal, [])
01272         reply = self.actions.reply_actions.reply
01273         self.assertEquals(reply.i18n_domain, '')
01274 
01275         updateActionsI18NDomain(self.portal, [])
01276         updateActionsI18NDomain(self.portal, [])
01277 
01278         self.assertEquals(reply.i18n_domain, 'plone')

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:


Member Data Documentation

Definition at line 1196 of file testMigrations.py.

Definition at line 1210 of file testMigrations.py.

Definition at line 1201 of file testMigrations.py.

Definition at line 1197 of file testMigrations.py.

Definition at line 1198 of file testMigrations.py.


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