Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def testRemovePloneCssFromRR
def testRemovePloneCssFromRRTwice
def testRemovePloneCssFromRRNoCSS
def testRemovePloneCssFromRRNoTool
def testAddEventRegistrationJS
def testAddEventRegistrationJSTwice
def testAddEventRegistrationJSNoTool
def testFixupPloneLexicon
def testFixupPloneLexiconTwice
def testFixupPloneLexiconNoLexicon
def testFixupPloneLexiconNoTool
def tesFixObjDeleteActionTwice
def testFixObjDeleteActionNoAction
def testFixObjDeleteActionNoTool
def testSetLoginFormInCookieAuth
def testSetLoginFormNoCookieAuth
def testSetLoginFormAlreadyChanged
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
 memberdata
 catalog
 skins
 types
 workflow
 css

Detailed Description

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

00976 
00977     def afterSetUp(self):
00978         self.actions = self.portal.portal_actions
00979         self.memberdata = self.portal.portal_memberdata
00980         self.catalog = self.portal.portal_catalog
00981         self.skins = self.portal.portal_skins
00982         self.types = self.portal.portal_types
00983         self.workflow = self.portal.portal_workflow
00984         self.css = self.portal.portal_css

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

01068 
01069     def tesFixObjDeleteActionTwice(self):
01070         # Should not error if performed twice
01071         editActions = ('delete',)
01072         for a in editActions:
01073             self.removeActionFromTool(a)
01074         fixObjDeleteAction(self.portal, [])
01075         fixObjDeleteAction(self.portal, [])
01076         actions = [x.id for x in self.actions.listActions()
01077                    if x.id in editActions]
01078         # check that all of our deleted actions are now present
01079         for a in editActions:
01080             self.failUnless(a in actions)
01081         # ensure that they are present only once
01082         self.failUnlessEqual(len(editActions), len(actions))

Here is the call graph for this function:

Definition at line 1010 of file testMigrations.py.

01010 
01011     def testAddEventRegistrationJS(self):
01012         jsreg = self.portal.portal_javascripts
01013         # unregister first
01014         jsreg.unregisterResource('event-registration.js')
01015         script_ids = jsreg.getResourceIds()
01016         self.failIf('event-registration.js' in script_ids)
01017         # migrate and test again
01018         addEventRegistrationJS(self.portal, [])
01019         script_ids = jsreg.getResourceIds()
01020         self.failUnless('event-registration.js' in script_ids)
01021         self.assertEqual(jsreg.getResourcePosition('event-registration.js'), 0)

Here is the call graph for this function:

Definition at line 1036 of file testMigrations.py.

01036 
01037     def testAddEventRegistrationJSNoTool(self):
01038         # Should not break if the tool is missing
01039         self.portal._delObject('portal_javascripts')
01040         addEventRegistrationJS(self.portal, [])

Here is the call graph for this function:

Definition at line 1022 of file testMigrations.py.

01022 
01023     def testAddEventRegistrationJSTwice(self):
01024         # Should not break if migrated again
01025         jsreg = self.portal.portal_javascripts
01026         # unregister first
01027         jsreg.unregisterResource('event-registration.js')
01028         script_ids = jsreg.getResourceIds()
01029         self.failIf('event-registration.js' in script_ids)
01030         # migrate and test again
01031         addEventRegistrationJS(self.portal, [])
01032         addEventRegistrationJS(self.portal, [])
01033         script_ids = jsreg.getResourceIds()
01034         self.failUnless('event-registration.js' in script_ids)
01035         self.assertEqual(jsreg.getResourcePosition('event-registration.js'), 0)

Here is the call graph for this function:

Definition at line 1083 of file testMigrations.py.

01083 
01084     def testFixObjDeleteActionNoAction(self):
01085         # Should add the action
01086         editActions = ('delete',)
01087         for a in editActions:
01088             self.removeActionFromTool(a)
01089         fixObjDeleteAction(self.portal, [])
01090         actions = [x for x in self.actions.object_buttons.objectIds()
01091                    if x in editActions]
01092         for a in editActions:
01093             self.failUnless(a in actions)
01094         self.failUnlessEqual(len(editActions), len(actions))

Here is the call graph for this function:

Definition at line 1095 of file testMigrations.py.

01095 
01096     def testFixObjDeleteActionNoTool(self):
01097         self.portal._delObject('portal_actions')
01098         fixObjDeleteAction(self.portal, [])

Here is the call graph for this function:

Definition at line 1041 of file testMigrations.py.

01041 
01042     def testFixupPloneLexicon(self):
01043         # Should update the plone_lexicon pipeline
01044         lexicon = self.portal.portal_catalog.plone_lexicon
01045         lexicon._pipeline = (object(), object())
01046         fixupPloneLexicon(self.portal, [])
01047         self.failUnless(isinstance(lexicon._pipeline[0], Splitter))
01048         self.failUnless(isinstance(lexicon._pipeline[1], CaseNormalizer))

Here is the call graph for this function:

Definition at line 1058 of file testMigrations.py.

01058 
01059     def testFixupPloneLexiconNoLexicon(self):
01060         # Should not break if plone_lexicon is missing
01061         self.portal.portal_catalog._delObject('plone_lexicon')
01062         fixupPloneLexicon(self.portal, [])

Here is the call graph for this function:

Definition at line 1063 of file testMigrations.py.

01063 
01064     def testFixupPloneLexiconNoTool(self):
01065         # Should not break if portal_catalog is missing
01066         self.portal._delObject('portal_catalog')
01067         fixupPloneLexicon(self.portal, [])

Here is the call graph for this function:

Definition at line 1049 of file testMigrations.py.

01049 
01050     def testFixupPloneLexiconTwice(self):
01051         # Should not break if migrated again
01052         lexicon = self.portal.portal_catalog.plone_lexicon
01053         lexicon._pipeline = (object(), object())
01054         fixupPloneLexicon(self.portal, [])
01055         fixupPloneLexicon(self.portal, [])
01056         self.failUnless(isinstance(lexicon._pipeline[0], Splitter))
01057         self.failUnless(isinstance(lexicon._pipeline[1], CaseNormalizer))

Here is the call graph for this function:

Definition at line 985 of file testMigrations.py.

00985 
00986     def testRemovePloneCssFromRR(self):
00987         # Check to ensure that plone.css gets removed from portal_css
00988         self.css.registerStylesheet('plone.css', media='all')
00989         self.failUnless('plone.css' in self.css.getResourceIds())
00990         removePloneCssFromRR(self.portal, [])
00991         self.failIf('plone.css' in self.css.getResourceIds())

Here is the call graph for this function:

Definition at line 1000 of file testMigrations.py.

01000 
01001     def testRemovePloneCssFromRRNoCSS(self):
01002         # Should not fail if the stylesheet is missing
01003         self.failIf('plone.css' in self.css.getResourceIds())
01004         removePloneCssFromRR(self.portal, [])

Here is the call graph for this function:

Definition at line 1005 of file testMigrations.py.

01005 
01006     def testRemovePloneCssFromRRNoTool(self):
01007         # Should not fail if the tool is missing
01008         self.portal._delObject('portal_css')
01009         removePloneCssFromRR(self.portal, [])

Here is the call graph for this function:

Definition at line 992 of file testMigrations.py.

00992 
00993     def testRemovePloneCssFromRRTwice(self):
00994         # Should not fail if performed twice
00995         self.css.registerStylesheet('plone.css', media='all')
00996         self.failUnless('plone.css' in self.css.getResourceIds())
00997         removePloneCssFromRR(self.portal, [])
00998         removePloneCssFromRR(self.portal, [])
00999         self.failIf('plone.css' in self.css.getResourceIds())

Here is the call graph for this function:

Definition at line 1111 of file testMigrations.py.

01111 
01112     def testSetLoginFormAlreadyChanged(self):
01113         # Shouldn't change the value if it's not the default
01114         cookie_auth = self.portal.acl_users.credentials_cookie_auth
01115         cookie_auth.manage_changeProperties(login_path='foo')
01116         out = []
01117         setLoginFormInCookieAuth(self.portal, out)
01118         self.failIf(len(out) > 0)
01119         self.failIfEqual(cookie_auth.getProperty('login_path'),
01120                          'require_login')

Here is the call graph for this function:

Definition at line 1099 of file testMigrations.py.

01099 
01100     def testSetLoginFormInCookieAuth(self):
01101         setLoginFormInCookieAuth(self.portal, [])
01102         cookie_auth = self.portal.acl_users.credentials_cookie_auth
01103         self.failUnlessEqual(cookie_auth.getProperty('login_path'),
01104                              'require_login')

Here is the call graph for this function:

Definition at line 1105 of file testMigrations.py.

01105 
01106     def testSetLoginFormNoCookieAuth(self):
01107         # Shouldn't error
01108         uf = self.portal.acl_users
01109         uf._delOb('credentials_cookie_auth')
01110         setLoginFormInCookieAuth(self.portal, [])

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

Definition at line 979 of file testMigrations.py.

Definition at line 983 of file testMigrations.py.

Definition at line 978 of file testMigrations.py.

Definition at line 980 of file testMigrations.py.

Definition at line 981 of file testMigrations.py.

Definition at line 982 of file testMigrations.py.


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