Back to index

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

List of all members.

Public Member Functions

def test_empty
def test_normal
def test_with_filenames

Static Public Attributes

 layer = ExportImportZCMLLayer

Detailed Description

Definition at line 1778 of file test_exportimport.py.


Member Function Documentation

Definition at line 1782 of file test_exportimport.py.

01782 
01783     def test_empty( self ):
01784         from Products.CMFCore.exportimport.workflow import exportWorkflowTool
01785 
01786         site = self._initSite()
01787         context = DummyExportContext( site )
01788         exportWorkflowTool( context )
01789 
01790         self.assertEqual( len( context._wrote ), 1 )
01791         filename, text, content_type = context._wrote[ 0 ]
01792         self.assertEqual( filename, 'workflows.xml' )
01793         self._compareDOM( text, _EMPTY_TOOL_EXPORT )
01794         self.assertEqual( content_type, 'text/xml' )

Here is the call graph for this function:

Definition at line 1795 of file test_exportimport.py.

01795 
01796     def test_normal( self ):
01797         from Products.CMFCore.exportimport.workflow import exportWorkflowTool
01798 
01799         WF_ID_NON = 'non_dcworkflow'
01800         WF_TITLE_NON = 'Non-DCWorkflow'
01801         WF_DESCRIPTION_NON = 'Not a DCWorkflow'
01802         WF_ID_DC = 'dcworkflow'
01803         WF_TITLE_DC = 'DCWorkflow'
01804         WF_DESCRIPTION_DC = 'I am a DCWorkflow'
01805         WF_INITIAL_STATE = 'closed'
01806 
01807         site = self._initSite()
01808 
01809         wf_tool = site.portal_workflow
01810         nondcworkflow = DummyWorkflow( WF_TITLE_NON )
01811         nondcworkflow.title = WF_TITLE_NON
01812         nondcworkflow.description = WF_DESCRIPTION_NON
01813         wf_tool._setObject( WF_ID_NON, nondcworkflow )
01814 
01815         dcworkflow = self._initDCWorkflow( WF_ID_DC )
01816         dcworkflow.title = WF_TITLE_DC
01817         dcworkflow.description = WF_DESCRIPTION_DC
01818         dcworkflow.initial_state = WF_INITIAL_STATE
01819         dcworkflow.permissions = _WF_PERMISSIONS
01820         self._initVariables( dcworkflow )
01821         self._initStates( dcworkflow )
01822         self._initTransitions( dcworkflow )
01823         self._initWorklists( dcworkflow )
01824         self._initScripts( dcworkflow )
01825 
01826         context = DummyExportContext( site )
01827         exportWorkflowTool( context )
01828 
01829         # workflows list, wf defintion and 3 scripts
01830         self.assertEqual( len( context._wrote ), 6 )
01831 
01832         filename, text, content_type = context._wrote[ 0 ]
01833         self.assertEqual( filename, 'workflows.xml' )
01834         self._compareDOM( text, _NORMAL_TOOL_EXPORT )
01835         self.assertEqual( content_type, 'text/xml' )
01836 
01837         filename, text, content_type = context._wrote[ 2 ]
01838         self.assertEqual( filename, 'workflows/%s/definition.xml' % WF_ID_DC )
01839         self._compareDOM( text
01840                         , _NORMAL_WORKFLOW_EXPORT
01841                           % { 'workflow_id' : WF_ID_DC
01842                             , 'title' : WF_TITLE_DC
01843                             , 'description' : WF_DESCRIPTION_DC
01844                             , 'initial_state' : WF_INITIAL_STATE
01845                             , 'workflow_filename' : WF_ID_DC.replace(' ', '_')
01846                             } )
01847         self.assertEqual( content_type, 'text/xml' )
01848 
01849         # just testing first script
01850         filename, text, content_type = context._wrote[ 3 ]
01851         self.assertEqual( filename, 'workflows/%s/scripts/after_close.py' % WF_ID_DC )
01852         self.assertEqual( text, _AFTER_CLOSE_SCRIPT)
01853         self.assertEqual( content_type, 'text/plain' )

Here is the call graph for this function:

Definition at line 1854 of file test_exportimport.py.

01854 
01855     def test_with_filenames( self ):
01856         from Products.CMFCore.exportimport.workflow import exportWorkflowTool
01857 
01858         WF_ID_DC = 'name with spaces'
01859         WF_TITLE_DC = 'DCWorkflow with spaces'
01860         WF_DESCRIPTION_DC = 'Workflow w/spaces'
01861         WF_INITIAL_STATE = 'closed'
01862 
01863         site = self._initSite()
01864 
01865         dcworkflow = self._initDCWorkflow( WF_ID_DC )
01866         dcworkflow.title = WF_TITLE_DC
01867         dcworkflow.description = WF_DESCRIPTION_DC
01868         dcworkflow.initial_state = WF_INITIAL_STATE
01869         dcworkflow.permissions = _WF_PERMISSIONS
01870         self._initVariables( dcworkflow )
01871         self._initStates( dcworkflow )
01872         self._initTransitions( dcworkflow )
01873         self._initWorklists( dcworkflow )
01874         self._initScripts( dcworkflow )
01875 
01876         context = DummyExportContext( site )
01877         exportWorkflowTool( context )
01878 
01879         # workflows list, wf defintion and 3 scripts
01880         self.assertEqual( len( context._wrote ), 5 )
01881 
01882         filename, text, content_type = context._wrote[ 0 ]
01883         self.assertEqual( filename, 'workflows.xml' )
01884         self._compareDOM( text, _FILENAME_TOOL_EXPORT )
01885         self.assertEqual( content_type, 'text/xml' )
01886 
01887         filename, text, content_type = context._wrote[ 1 ]
01888         self.assertEqual( filename
01889                         , 'workflows/name_with_spaces/definition.xml' )
01890         self._compareDOM( text
01891                         , _NORMAL_WORKFLOW_EXPORT
01892                           % { 'workflow_id' : WF_ID_DC
01893                             , 'title' : WF_TITLE_DC
01894                             , 'description' : WF_DESCRIPTION_DC
01895                             , 'initial_state' : WF_INITIAL_STATE
01896                             , 'workflow_filename' : WF_ID_DC.replace(' ', '_')
01897                             } )
01898         self.assertEqual( content_type, 'text/xml' )
01899 
01900         # just testing first script
01901         filename, text, content_type = context._wrote[ 2 ]
01902         self.assertEqual( filename, 'workflows/%s/scripts/after_close.py' %
01903                           WF_ID_DC.replace(' ', '_'))
01904         self.assertEqual( text, _AFTER_CLOSE_SCRIPT)
01905         self.assertEqual( content_type, 'text/plain' )
01906 

Here is the call graph for this function:


Member Data Documentation

Definition at line 1780 of file test_exportimport.py.


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