Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Private Member Functions
DCWorkflow.tests.test_exportimport.Test_importWorkflow Class Reference
Inheritance diagram for DCWorkflow.tests.test_exportimport.Test_importWorkflow:
Inheritance graph
[legend]
Collaboration diagram for DCWorkflow.tests.test_exportimport.Test_importWorkflow:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_empty_default_purge
def test_empty_explicit_purge
def test_empty_skip_purge
def test_bindings_skip_purge
def test_import_twice_nopurge
def test_from_empty_dcworkflow_top_level
def test_from_empty_dcworkflow_workflow_attrs
def test_from_empty_dcworkflow_workflow_permissions
def test_from_empty_dcworkflow_workflow_variables
def test_from_empty_dcworkflow_workflow_states
def test_from_empty_dcworkflow_workflow_transitions
def test_from_empty_dcworkflow_workflow_worklists
def test_from_old_dcworkflow_workflow_scripts
def test_from_empty_dcworkflow_workflow_scripts
def test_scripts_with_invalid_meta_type
def test_scripts_by_meta_type

Static Public Attributes

 layer = ExportImportZCMLLayer

Private Member Functions

def _importNormalWorkflow
def _prepareImportNormalWorkflow
def _importOldWorkflow

Detailed Description

Definition at line 1907 of file test_exportimport.py.


Member Function Documentation

def DCWorkflow.tests.test_exportimport.Test_importWorkflow._importNormalWorkflow (   self,
  wf_id,
  wf_title,
  wf_description,
  wf_initial_state 
) [private]

Definition at line 1912 of file test_exportimport.py.

01912 
01913                                wf_description, wf_initial_state ):
01914         from Products.CMFCore.exportimport.workflow import importWorkflowTool
01915 
01916         site, context = self._prepareImportNormalWorkflow(
01917             wf_id, wf_title, wf_description, wf_initial_state)
01918 
01919         importWorkflowTool(context)
01920 
01921         return site.portal_workflow

Here is the call graph for this function:

Here is the caller graph for this function:

def DCWorkflow.tests.test_exportimport.Test_importWorkflow._importOldWorkflow (   self,
  wf_id,
  wf_title,
  wf_initial_state 
) [private]

Definition at line 1957 of file test_exportimport.py.

01957 
01958     def _importOldWorkflow( self, wf_id, wf_title, wf_initial_state ):
01959         from Products.CMFCore.exportimport.workflow import importWorkflowTool
01960 
01961         site = self._initSite()
01962         wf_tool = site.portal_workflow
01963         workflow_filename = wf_id.replace(' ', '_')
01964 
01965         context = DummyImportContext( site )
01966         context._files[ 'workflows.xml'
01967                       ] = (_NORMAL_TOOL_EXPORT_WITH_FILENAME
01968                             % { 'workflow_id' : wf_id
01969                               }
01970                           )
01971 
01972         context._files[ 'workflows/%s/definition.xml' % workflow_filename
01973                       ] = ( _OLD_WORKFLOW_EXPORT
01974                             % { 'workflow_id' : wf_id
01975                               , 'title' : wf_title
01976                               , 'initial_state' : wf_initial_state
01977                               , 'workflow_filename' : workflow_filename
01978                               }
01979                           )
01980 
01981         context._files[ 'workflows/%s/after_close.py' % workflow_filename
01982                       ] = _AFTER_CLOSE_SCRIPT
01983 
01984         context._files[ 'workflows/%s/after_kill.py' % workflow_filename
01985                       ] = _AFTER_KILL_SCRIPT
01986 
01987         context._files[ 'workflows/%s/before_open.py' % workflow_filename
01988                       ] = _BEFORE_OPEN_SCRIPT
01989 
01990         importWorkflowTool( context )
01991 
01992         return wf_tool

Here is the call graph for this function:

Here is the caller graph for this function:

def DCWorkflow.tests.test_exportimport.Test_importWorkflow._prepareImportNormalWorkflow (   self,
  wf_id,
  wf_title,
  wf_description,
  wf_initial_state,
  site = None,
  purge = True 
) [private]

Definition at line 1923 of file test_exportimport.py.

01923 
01924                                      wf_initial_state, site=None, purge=True):
01925         if site is None:
01926             site = self._initSite()
01927         workflow_filename = wf_id.replace(' ', '_')
01928 
01929         context = DummyImportContext(site, purge=purge)
01930         context._files[ 'workflows.xml'
01931                       ] = (_NORMAL_TOOL_EXPORT_WITH_FILENAME
01932                             % { 'workflow_id' : wf_id
01933                               }
01934                           )
01935 
01936         context._files[ 'workflows/%s/definition.xml' % workflow_filename
01937                       ] = ( _NORMAL_WORKFLOW_EXPORT
01938                             % { 'workflow_id' : wf_id
01939                               , 'title' : wf_title
01940                               , 'description' : wf_description
01941                               , 'initial_state' : wf_initial_state
01942                               , 'workflow_filename' : workflow_filename
01943                               }
01944                           )
01945 
01946         context._files[ 'workflows/%s/scripts/after_close.py' % workflow_filename
01947                       ] = _AFTER_CLOSE_SCRIPT
01948 
01949         context._files[ 'workflows/%s/scripts/after_kill.py' % workflow_filename
01950                       ] = _AFTER_KILL_SCRIPT
01951 
01952         context._files[ 'workflows/%s/scripts/before_open.py' % workflow_filename
01953                       ] = _BEFORE_OPEN_SCRIPT
01954 
01955         return site, context
01956 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2075 of file test_exportimport.py.

02075 
02076     def test_bindings_skip_purge( self ):
02077         from Products.CMFCore.exportimport.workflow import importWorkflowTool
02078 
02079         WF_ID_NON = 'non_dcworkflow_%s'
02080         WF_TITLE_NON = 'Non-DCWorkflow #%s'
02081 
02082         site = self._initSite()
02083         wf_tool = site.portal_workflow
02084 
02085         for i in range( 4 ):
02086             nondcworkflow = DummyWorkflow( WF_TITLE_NON % i )
02087             nondcworkflow.title = WF_TITLE_NON % i
02088             wf_tool._setObject( WF_ID_NON % i, nondcworkflow )
02089 
02090         wf_tool._default_chain = ( WF_ID_NON % 1, )
02091         wf_tool._chains_by_type[ 'sometype' ] = ( WF_ID_NON % 2, )
02092         self.assertEqual( len( wf_tool.objectIds() ), 4 )
02093 
02094         context = DummyImportContext( site, False )
02095         context._files[ 'workflows.xml' ] = _BINDINGS_TOOL_EXPORT
02096         importWorkflowTool( context )
02097 
02098         self.assertEqual( len( wf_tool.objectIds() ), 4 )
02099         self.assertEqual( len( wf_tool._default_chain ), 2 )
02100         self.assertEqual( wf_tool._default_chain[ 0 ], WF_ID_NON % 0 )
02101         self.assertEqual( wf_tool._default_chain[ 1 ], WF_ID_NON % 1 )
02102         self.assertEqual( len( wf_tool._chains_by_type ), 2 )
02103         self.assertEqual( wf_tool._chains_by_type[ 'sometype' ]
02104                         , ( WF_ID_NON % 2, )
02105                         )
02106         self.assertEqual( wf_tool._chains_by_type[ 'anothertype' ]
02107                         , ( WF_ID_NON % 3, )
02108                         )

Here is the call graph for this function:

Definition at line 1993 of file test_exportimport.py.

01993 
01994     def test_empty_default_purge( self ):
01995         from Products.CMFCore.exportimport.workflow import importWorkflowTool
01996 
01997         WF_ID_NON = 'non_dcworkflow_%s'
01998         WF_TITLE_NON = 'Non-DCWorkflow #%s'
01999 
02000         site = self._initSite()
02001         wf_tool = site.portal_workflow
02002 
02003         for i in range( 4 ):
02004             nondcworkflow = DummyWorkflow( WF_TITLE_NON % i )
02005             nondcworkflow.title = WF_TITLE_NON % i
02006             wf_tool._setObject( WF_ID_NON % i, nondcworkflow )
02007 
02008         wf_tool._default_chain = ( WF_ID_NON % 1, )
02009         wf_tool._chains_by_type[ 'sometype' ] = ( WF_ID_NON % 2, )
02010         self.assertEqual( len( wf_tool.objectIds() ), 4 )
02011 
02012         context = DummyImportContext( site )
02013         context._files[ 'workflows.xml' ] = _EMPTY_TOOL_EXPORT
02014         importWorkflowTool( context )
02015 
02016         self.assertEqual( len( wf_tool.objectIds() ), 0 )
02017         self.assertEqual( len( wf_tool._default_chain ), 0 )
02018         self.assertEqual( len( wf_tool._chains_by_type ), 0 )

Here is the call graph for this function:

Definition at line 2019 of file test_exportimport.py.

02019 
02020     def test_empty_explicit_purge( self ):
02021         from Products.CMFCore.exportimport.workflow import importWorkflowTool
02022 
02023         WF_ID_NON = 'non_dcworkflow_%s'
02024         WF_TITLE_NON = 'Non-DCWorkflow #%s'
02025 
02026         site = self._initSite()
02027         wf_tool = site.portal_workflow
02028 
02029         for i in range( 4 ):
02030             nondcworkflow = DummyWorkflow( WF_TITLE_NON % i )
02031             nondcworkflow.title = WF_TITLE_NON % i
02032             wf_tool._setObject( WF_ID_NON % i, nondcworkflow )
02033 
02034         wf_tool._default_chain = ( WF_ID_NON % 1, )
02035         wf_tool._chains_by_type[ 'sometype' ] = ( WF_ID_NON % 2, )
02036         self.assertEqual( len( wf_tool.objectIds() ), 4 )
02037 
02038         context = DummyImportContext( site, True )
02039         context._files[ 'workflows.xml' ] = _EMPTY_TOOL_EXPORT
02040         importWorkflowTool( context )
02041 
02042         self.assertEqual( len( wf_tool.objectIds() ), 0 )
02043         self.assertEqual( len( wf_tool._default_chain ), 0 )
02044         self.assertEqual( len( wf_tool._chains_by_type ), 0 )

Here is the call graph for this function:

Definition at line 2045 of file test_exportimport.py.

02045 
02046     def test_empty_skip_purge( self ):
02047         from Products.CMFCore.exportimport.workflow import importWorkflowTool
02048 
02049         WF_ID_NON = 'non_dcworkflow_%s'
02050         WF_TITLE_NON = 'Non-DCWorkflow #%s'
02051 
02052         site = self._initSite()
02053         wf_tool = site.portal_workflow
02054 
02055         for i in range( 4 ):
02056             nondcworkflow = DummyWorkflow( WF_TITLE_NON % i )
02057             nondcworkflow.title = WF_TITLE_NON % i
02058             wf_tool._setObject( WF_ID_NON % i, nondcworkflow )
02059 
02060         wf_tool._default_chain = ( WF_ID_NON % 1, )
02061         wf_tool._chains_by_type[ 'sometype' ] = ( WF_ID_NON % 2, )
02062         self.assertEqual( len( wf_tool.objectIds() ), 4 )
02063 
02064         context = DummyImportContext( site, False )
02065         context._files[ 'typestool.xml' ] = _EMPTY_TOOL_EXPORT
02066         importWorkflowTool( context )
02067 
02068         self.assertEqual( len( wf_tool.objectIds() ), 4 )
02069         self.assertEqual( len( wf_tool._default_chain ), 1 )
02070         self.assertEqual( wf_tool._default_chain[ 0 ], WF_ID_NON % 1 )
02071         self.assertEqual( len( wf_tool._chains_by_type ), 1 )
02072         self.assertEqual( wf_tool._chains_by_type[ 'sometype' ]
02073                         , ( WF_ID_NON % 2, )
02074                         )

Here is the call graph for this function:

Definition at line 2148 of file test_exportimport.py.

02148 
02149     def test_from_empty_dcworkflow_top_level( self ):
02150 
02151         WF_ID = 'dcworkflow_tool'
02152         WF_TITLE = 'DC Workflow testing tool'
02153         WF_DESCRIPTION = 'Testing Tool'
02154         WF_INITIAL_STATE = 'closed'
02155 
02156         tool = self._importNormalWorkflow( WF_ID, WF_TITLE,
02157                                            WF_DESCRIPTION, WF_INITIAL_STATE )
02158 
02159         self.assertEqual( len( tool.objectIds() ), 2 )
02160         self.assertEqual( tool.objectIds()[ 1 ], WF_ID )

Here is the call graph for this function:

Definition at line 2161 of file test_exportimport.py.

02161 
02162     def test_from_empty_dcworkflow_workflow_attrs( self ):
02163 
02164         WF_ID = 'dcworkflow_attrs'
02165         WF_TITLE = 'DC Workflow testing attrs'
02166         WF_DESCRIPTION = 'Testing Attributes'
02167         WF_INITIAL_STATE = 'closed'
02168 
02169         tool = self._importNormalWorkflow( WF_ID, WF_TITLE,
02170                                            WF_DESCRIPTION, WF_INITIAL_STATE )
02171 
02172         workflow = tool.objectValues()[ 1 ]
02173         self.assertEqual( workflow.meta_type, DCWorkflowDefinition.meta_type )
02174         self.assertEqual( workflow.title, WF_TITLE )
02175         self.assertEqual( workflow.state_var, 'state' )
02176         self.assertEqual( workflow.initial_state, WF_INITIAL_STATE )

Here is the call graph for this function:

Definition at line 2177 of file test_exportimport.py.

02177 
02178     def test_from_empty_dcworkflow_workflow_permissions( self ):
02179 
02180         WF_ID = 'dcworkflow_permissions'
02181         WF_TITLE = 'DC Workflow testing permissions'
02182         WF_DESCRIPTION = 'Testing Permissions'
02183         WF_INITIAL_STATE = 'closed'
02184 
02185         tool = self._importNormalWorkflow( WF_ID, WF_TITLE,
02186                                            WF_DESCRIPTION, WF_INITIAL_STATE )
02187 
02188         workflow = tool.objectValues()[ 1 ]
02189 
02190         permissions = workflow.permissions
02191         self.assertEqual( len( permissions ), len( _WF_PERMISSIONS ) )
02192 
02193         for permission in permissions:
02194             self.failUnless( permission in _WF_PERMISSIONS )

Here is the call graph for this function:

Definition at line 2400 of file test_exportimport.py.

02400 
02401     def test_from_empty_dcworkflow_workflow_scripts( self ):
02402 
02403         WF_ID = 'dcworkflow_scripts'
02404         WF_TITLE = 'DC Workflow testing scripts'
02405         WF_DESCRIPTION = 'Testing Scripts'
02406         WF_INITIAL_STATE = 'closed'
02407 
02408         tool = self._importNormalWorkflow( WF_ID, WF_TITLE, 
02409                                            WF_DESCRIPTION, WF_INITIAL_STATE )
02410 
02411         workflow = tool.objectValues()[ 1 ]
02412 
02413         scripts = workflow.scripts
02414 
02415         self.assertEqual( len( scripts.objectItems() )
02416                         , len( _WF_SCRIPTS ) )
02417 
02418         for script_id, script in scripts.objectItems():
02419 
02420             expected = _WF_SCRIPTS[ script_id ]
02421 
02422             self.assertEqual( script.meta_type, expected[ 0 ] )
02423 
02424             if script.meta_type == PythonScript.meta_type:
02425                 self.assertEqual( script.manage_FTPget(), expected[ 1 ] )

Here is the call graph for this function:

Definition at line 2229 of file test_exportimport.py.

02229 
02230     def test_from_empty_dcworkflow_workflow_states( self ):
02231 
02232         WF_ID = 'dcworkflow_states'
02233         WF_TITLE = 'DC Workflow testing states'
02234         WF_DESCRIPTION = 'Testing States'
02235         WF_INITIAL_STATE = 'closed'
02236 
02237         tool = self._importNormalWorkflow( WF_ID, WF_TITLE,
02238                                            WF_DESCRIPTION, WF_INITIAL_STATE )
02239 
02240         workflow = tool.objectValues()[ 1 ]
02241 
02242         states = workflow.states
02243 
02244         self.assertEqual( len( states.objectItems() )
02245                         , len( _WF_STATES ) )
02246 
02247         for id, state in states.objectItems():
02248 
02249             expected = _WF_STATES[ state.getId() ]
02250             self.assertEqual( state.title, expected[ 0 ] )
02251             self.failUnless( expected[ 1 ] in state.description )
02252 
02253             self.assertEqual( len( state.transitions ), len( expected[ 2 ] ) )
02254 
02255             for transition_id in state.transitions:
02256                 self.failUnless( transition_id in expected[ 2 ] )
02257 
02258             for permission in state.getManagedPermissions():
02259 
02260                 p_info = state.getPermissionInfo( permission )
02261                 p_expected = expected[ 3 ].get( permission, [] )
02262 
02263                 self.assertEqual( bool( p_info[ 'acquired' ] )
02264                                 , isinstance(p_expected, list) )
02265 
02266                 self.assertEqual( len( p_info[ 'roles' ] ), len( p_expected ) )
02267 
02268                 for role in p_info[ 'roles' ]:
02269                     self.failIf( role not in p_expected )
02270 
02271             group_roles = state.group_roles or {}
02272             self.assertEqual( len( group_roles ), len( expected[ 4 ] ) )
02273 
02274             for group_id, exp_roles in expected[ 4 ]:
02275 
02276                 self.assertEqual( len( state.getGroupInfo( group_id ) )
02277                                 , len( exp_roles ) )
02278 
02279                 for role in state.getGroupInfo( group_id ):
02280                     self.failUnless( role in exp_roles )
02281 
02282             self.assertEqual( len( state.getVariableValues() )
02283                             , len( expected[ 5 ] ) )
02284 
02285             for var_id, value in state.getVariableValues():
02286 
02287                 self.assertEqual( value, expected[ 5 ][ var_id ] )

Here is the call graph for this function:

Definition at line 2288 of file test_exportimport.py.

02288 
02289     def test_from_empty_dcworkflow_workflow_transitions( self ):
02290 
02291         WF_ID = 'dcworkflow_transitions'
02292         WF_TITLE = 'DC Workflow testing transitions'
02293         WF_DESCRIPTION = 'Testing Transitions'
02294         WF_INITIAL_STATE = 'closed'
02295 
02296         tool = self._importNormalWorkflow( WF_ID, WF_TITLE,
02297                                            WF_DESCRIPTION, WF_INITIAL_STATE )
02298 
02299         workflow = tool.objectValues()[ 1 ]
02300 
02301         transitions = workflow.transitions
02302 
02303         self.assertEqual( len( transitions.objectItems() )
02304                         , len( _WF_TRANSITIONS ) )
02305 
02306         for id, transition in transitions.objectItems():
02307 
02308             expected = _WF_TRANSITIONS[ transition.getId() ]
02309             self.assertEqual( transition.title, expected[ 0 ] )
02310             self.failUnless( expected[ 1 ] in transition.description )
02311             self.assertEqual( transition.new_state_id, expected[ 2 ] )
02312             self.assertEqual( transition.trigger_type, expected[ 3 ] )
02313             self.assertEqual( transition.script_name, expected[ 4 ] )
02314             self.assertEqual( transition.after_script_name, expected[ 5 ] )
02315             self.assertEqual( transition.actbox_name, expected[ 6 ] )
02316             self.assertEqual( transition.actbox_url, expected[ 7 ] )
02317             self.assertEqual( transition.actbox_category, expected[ 8 ] )
02318 
02319             var_exprs = transition.var_exprs
02320 
02321             self.assertEqual( len( var_exprs ), len( expected[ 9 ] ) )
02322 
02323             for var_id, expr in var_exprs.items():
02324                 self.assertEqual( expr.text, expected[ 9 ][ var_id ] )
02325 
02326             guard = transition.getGuard()
02327 
02328             self.assertEqual( guard.permissions, expected[ 10 ] )
02329             self.assertEqual( guard.roles, expected[ 11 ] )
02330             self.assertEqual( guard.groups, expected[ 12 ] )
02331             self.assertEqual( guard.getExprText(), expected[ 13 ] )

Here is the call graph for this function:

Definition at line 2195 of file test_exportimport.py.

02195 
02196     def test_from_empty_dcworkflow_workflow_variables( self ):
02197 
02198         WF_ID = 'dcworkflow_variables'
02199         WF_TITLE = 'DC Workflow testing variables'
02200         WF_DESCRIPTION = 'Testing Variables'
02201         WF_INITIAL_STATE = 'closed'
02202 
02203         tool = self._importNormalWorkflow( WF_ID, WF_TITLE,
02204                                            WF_DESCRIPTION, WF_INITIAL_STATE )
02205 
02206         workflow = tool.objectValues()[ 1 ]
02207 
02208         variables = workflow.variables
02209 
02210         self.assertEqual( len( variables.objectItems() )
02211                         , len( _WF_VARIABLES ) )
02212 
02213         for id, variable in variables.objectItems():
02214 
02215             expected = _WF_VARIABLES[ variable.getId() ]
02216             self.failUnless( expected[ 0 ] in variable.description )
02217             self.assertEqual( variable.default_value, expected[ 1 ] )
02218             self.assertEqual( variable.getDefaultExprText(), expected[ 2 ] )
02219             self.assertEqual( variable.for_catalog, expected[ 3 ] )
02220             self.assertEqual( variable.for_status, expected[ 4 ] )
02221             self.assertEqual( variable.update_always, expected[ 5 ] )
02222 
02223             guard = variable.getInfoGuard()
02224 
02225             self.assertEqual( guard.permissions, expected[ 6 ] )
02226             self.assertEqual( guard.roles, expected[ 7 ] )
02227             self.assertEqual( guard.groups, expected[ 8 ] )
02228             self.assertEqual( guard.getExprText(), expected[ 9 ] )

Here is the call graph for this function:

Definition at line 2332 of file test_exportimport.py.

02332 
02333     def test_from_empty_dcworkflow_workflow_worklists( self ):
02334 
02335         WF_ID = 'dcworkflow_worklists'
02336         WF_TITLE = 'DC Workflow testing worklists'
02337         WF_DESCRIPTION = 'Testing Worklists'
02338         WF_INITIAL_STATE = 'closed'
02339 
02340         tool = self._importNormalWorkflow( WF_ID, WF_TITLE, 
02341                                            WF_DESCRIPTION, WF_INITIAL_STATE )
02342 
02343         workflow = tool.objectValues()[ 1 ]
02344 
02345         worklists = workflow.worklists
02346 
02347         self.assertEqual( len( worklists.objectItems() )
02348                         , len( _WF_WORKLISTS ) )
02349 
02350         for id, worklist in worklists.objectItems():
02351 
02352             expected = _WF_WORKLISTS[ worklist.getId() ]
02353             self.failUnless( expected[ 1 ] in worklist.description )
02354 
02355             var_matches = worklist.var_matches
02356 
02357             self.assertEqual( len( var_matches ), len( expected[ 2 ] ) )
02358 
02359             for var_id, values in var_matches.items():
02360                 exp_values = expected[ 2 ][ var_id ]
02361                 self.assertEqual( len( values ), len( exp_values ) )
02362 
02363                 for value in values:
02364                     self.failUnless( value in exp_values, values )
02365 
02366             self.assertEqual( worklist.actbox_name, expected[ 3 ] )
02367             self.assertEqual( worklist.actbox_url, expected[ 4 ] )
02368             self.assertEqual( worklist.actbox_category, expected[ 5 ] )
02369 
02370             guard = worklist.getGuard()
02371 
02372             self.assertEqual( guard.permissions, expected[ 6 ] )
02373             self.assertEqual( guard.roles, expected[ 7 ] )
02374             self.assertEqual( guard.groups, expected[ 8 ] )
02375             self.assertEqual( guard.getExprText(), expected[ 9 ] )

Here is the call graph for this function:

Definition at line 2376 of file test_exportimport.py.

02376 
02377     def test_from_old_dcworkflow_workflow_scripts( self ):
02378 
02379         WF_ID = 'old_dcworkflow_scripts'
02380         WF_TITLE = 'Old DC Workflow testing scripts'
02381         WF_INITIAL_STATE = 'closed'
02382 
02383         tool = self._importOldWorkflow( WF_ID, WF_TITLE, WF_INITIAL_STATE )
02384 
02385         workflow = tool.objectValues()[ 1 ]
02386 
02387         scripts = workflow.scripts
02388 
02389         self.assertEqual( len( scripts.objectItems() )
02390                         , len( _WF_SCRIPTS ) )
02391 
02392         for script_id, script in scripts.objectItems():
02393 
02394             expected = _WF_SCRIPTS[ script_id ]
02395 
02396             self.assertEqual( script.meta_type, expected[ 0 ] )
02397 
02398             if script.meta_type == PythonScript.meta_type:
02399                 self.assertEqual( script.manage_FTPget(), expected[ 1 ] )

Here is the call graph for this function:

Definition at line 2109 of file test_exportimport.py.

02109 
02110     def test_import_twice_nopurge(self):
02111         from Products.CMFCore.exportimport.workflow import importWorkflowTool
02112 
02113         WF_ID = 'dcworkflow_purge'
02114         WF_TITLE = 'DC Workflow testing purge'
02115         WF_DESCRIPTION = 'Test Purge'
02116         WF_INITIAL_STATE = 'closed'
02117 
02118         # Import a first time
02119         site, context = self._prepareImportNormalWorkflow(
02120             WF_ID, WF_TITLE, WF_DESCRIPTION, WF_INITIAL_STATE)
02121         importWorkflowTool(context)
02122 
02123         # Now reimport without purge
02124         site, context = self._prepareImportNormalWorkflow(
02125             WF_ID, WF_TITLE, WF_DESCRIPTION, WF_INITIAL_STATE, 
02126             site=site, purge=False)
02127         importWorkflowTool(context)
02128         workflow = site.portal_workflow.objectValues()[1]
02129 
02130         self.assertEqual(workflow.getId(), WF_ID)
02131         self.assertEqual(workflow.meta_type, DCWorkflowDefinition.meta_type)
02132         self.assertEqual(workflow.title, WF_TITLE)
02133         self.assertEqual(workflow.state_var, 'state')
02134         self.assertEqual(workflow.initial_state, WF_INITIAL_STATE)
02135         self.assertEqual(len(workflow.variables.objectItems()),
02136                          len(_WF_VARIABLES))
02137         self.assertEqual(len(workflow.states.objectItems()),
02138                          len(_WF_STATES))
02139         self.assertEqual(len(workflow.transitions.objectItems()),
02140                          len(_WF_TRANSITIONS))
02141         self.assertEqual(len(workflow.permissions),
02142                          len(_WF_PERMISSIONS))
02143         self.assertEqual(len(workflow.scripts.objectItems()),
02144                          len(_WF_SCRIPTS))
02145         self.assertEqual(len(workflow.worklists.objectItems()),
02146                          len(_WF_WORKLISTS))
02147 

Here is the call graph for this function:

Constructors for meta_types other than those hard coded should
be looked up.

Definition at line 2447 of file test_exportimport.py.

02447 
02448     def test_scripts_by_meta_type(self):
02449         """
02450         Constructors for meta_types other than those hard coded should
02451         be looked up.
02452         """
02453         from Products.DCWorkflow import exportimport
02454 
02455         tool = self._importNormalWorkflow(
02456             'dcworkflow_scripts', 'DC Workflow testing scripts',
02457             'Testing Scripts', 'closed')
02458         workflow = tool.objectValues()[1]
02459         scripts = workflow.scripts
02460 
02461         scripts.all_meta_types = scripts.all_meta_types() + [
02462             dict(instance=PythonScript, name='Foo Script')]
02463 
02464         s_infos = [
02465             dict(script_id='doc', meta_type='DTML Document',
02466                  filename=''),
02467             dict(script_id='bar', meta_type='Foo Script',
02468                  filename='')]
02469         exportimport._initDCWorkflowScripts(workflow, s_infos, None)
02470         
02471         self.assertEqual(scripts['doc'].meta_type, 'DTML Document')
02472         self.assertEqual(scripts['bar'].meta_type, 'Script (Python)')

Here is the call graph for this function:

A script with an invalid meta_type should raise an error.

Otherwise the previous script will be added for that script.

Definition at line 2426 of file test_exportimport.py.

02426 
02427     def test_scripts_with_invalid_meta_type(self):
02428         """
02429         A script with an invalid meta_type should raise an error.
02430 
02431         Otherwise the previous script will be added for that script.
02432         """
02433         from Products.DCWorkflow import exportimport
02434 
02435         tool = self._importNormalWorkflow(
02436             'dcworkflow_scripts', 'DC Workflow testing scripts',
02437             'Testing Scripts', 'closed')
02438         workflow = tool.objectValues()[1]
02439         scripts = workflow.scripts
02440 
02441         s_infos = [
02442             dict(script_id='invalid', meta_type='invalid',
02443                  filename='')]
02444         self.assertRaises(ValueError, 
02445                           exportimport._initDCWorkflowScripts,
02446                           workflow, s_infos, None)

Here is the call graph for this function:


Member Data Documentation

Definition at line 1909 of file test_exportimport.py.


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