[CMF-checkins] CVS: CMF/CMFSetup/tests - test_workflow.py:1.23

Yvo Schubbe y.2004_ at wcm-solutions.de
Thu Aug 5 16:48:29 EDT 2004


Update of /cvs-repository/CMF/CMFSetup/tests
In directory cvs.zope.org:/tmp/cvs-serv12529/CMFSetup/tests

Modified Files:
	test_workflow.py 
Log Message:
- made workflow export sorted to ease comparison
- some cleanup


=== CMF/CMFSetup/tests/test_workflow.py 1.22 => 1.23 ===
--- CMF/CMFSetup/tests/test_workflow.py:1.22	Mon Jul 19 16:08:36 2004
+++ CMF/CMFSetup/tests/test_workflow.py	Thu Aug  5 16:47:58 2004
@@ -1,11 +1,26 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE
+#
+##############################################################################
 """ Unit tests for export / import of DCWorkflows and bindings.
 
 $Id$
 """
+
 import unittest
+import Testing
+import Zope
+Zope.startup()
 
 from OFS.Folder import Folder
-
 from Products.PythonScripts.PythonScript import PythonScript
 
 from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
@@ -16,6 +31,7 @@
 from common import DummyExportContext
 from common import DummyImportContext
 
+
 class DummyWorkflowTool( Folder ):
 
     def __init__( self, id='portal_workflow' ):
@@ -121,7 +137,7 @@
                                   )
 
     def _initStates( self, dcworkflow ):
-        
+
         dcworkflow.groups = _WF_GROUPS
 
         for k, v in _WF_STATES.items():
@@ -153,7 +169,7 @@
                 state.addVariable( k, v )
 
     def _initTransitions( self, dcworkflow ):
-        
+
         for k, v in _WF_TRANSITIONS.items():
 
             dcworkflow.transitions.addTransition( k )
@@ -899,7 +915,7 @@
         , worklists
         , permissions
         , scripts
-        ) = configurator.parseWorkflowXML( 
+        ) = configurator.parseWorkflowXML(
                           _NORMAL_WORKFLOW_EXPORT
                           % { 'workflow_id' : WF_ID
                             , 'title' : WF_TITLE
@@ -962,7 +978,7 @@
         , worklists
         , permissions
         , scripts
-        ) = configurator.parseWorkflowXML( 
+        ) = configurator.parseWorkflowXML(
                           _NORMAL_WORKFLOW_EXPORT
                           % { 'workflow_id' : WF_ID
                             , 'title' : WF_TITLE
@@ -1029,7 +1045,7 @@
         , worklists
         , permissions
         , scripts
-        ) = configurator.parseWorkflowXML( 
+        ) = configurator.parseWorkflowXML(
                           _NORMAL_WORKFLOW_EXPORT
                           % { 'workflow_id' : WF_ID
                             , 'title' : WF_TITLE
@@ -1106,7 +1122,7 @@
         , worklists
         , permissions
         , scripts
-        ) = configurator.parseWorkflowXML( 
+        ) = configurator.parseWorkflowXML(
                           _NORMAL_WORKFLOW_EXPORT
                           % { 'workflow_id' : WF_ID
                             , 'title' : WF_TITLE
@@ -1167,7 +1183,7 @@
         , worklists
         , permissions
         , scripts
-        ) = configurator.parseWorkflowXML( 
+        ) = configurator.parseWorkflowXML(
                           _NORMAL_WORKFLOW_EXPORT
                           % { 'workflow_id' : WF_ID
                             , 'title' : WF_TITLE
@@ -1203,7 +1219,7 @@
         , worklists
         , permissions
         , scripts
-        ) = configurator.parseWorkflowXML( 
+        ) = configurator.parseWorkflowXML(
                           _NORMAL_WORKFLOW_EXPORT
                           % { 'workflow_id' : WF_ID
                             , 'title' : WF_TITLE
@@ -1550,7 +1566,7 @@
 <dc-workflow
     workflow_id="%s"
     title="%s"
-    state_variable="state" 
+    state_variable="state"
     initial_state="%s">
 </dc-workflow>
 """
@@ -1560,13 +1576,34 @@
 <dc-workflow
     workflow_id="%(workflow_id)s"
     title="%(title)s"
-    state_variable="state" 
+    state_variable="state"
     initial_state="%(initial_state)s">
  <permission>Open content for modifications</permission>
  <permission>Modify content</permission>
  <permission>Query history</permission>
  <permission>Restore expired content</permission>
  <state
+    state_id="closed"
+    title="Closed">
+  <description>Closed for modifications</description>
+  <exit-transition
+    transition_id="open"/>
+  <exit-transition
+    transition_id="kill"/>
+  <exit-transition
+    transition_id="expire"/>
+  <permission-map
+    acquired="False"
+    name="Modify content">
+  </permission-map>
+  <assignment
+    name="is_closed"
+    type="bool">True</assignment>
+  <assignment
+    name="is_opened"
+    type="bool">False</assignment>
+ </state>
+ <state
     state_id="expired"
     title="Expired">
   <description>Expiration date has passed</description>
@@ -1586,6 +1623,11 @@
     type="bool">False</assignment>
  </state>
  <state
+    state_id="killed"
+    title="Killed">
+  <description>Permanently unavailable</description>
+ </state>
+ <state
     state_id="opened"
     title="Opened">
   <description>Open for modifications</description>
@@ -1611,32 +1653,6 @@
     name="is_opened"
     type="bool">True</assignment>
  </state>
- <state
-    state_id="closed"
-    title="Closed">
-  <description>Closed for modifications</description>
-  <exit-transition
-    transition_id="open"/>
-  <exit-transition
-    transition_id="kill"/>
-  <exit-transition
-    transition_id="expire"/>
-  <permission-map
-    acquired="False"
-    name="Modify content">
-  </permission-map>
-  <assignment
-    name="is_closed"
-    type="bool">True</assignment>
-  <assignment
-    name="is_opened"
-    type="bool">False</assignment>
- </state>
- <state
-    state_id="killed"
-    title="Killed">
-  <description>Permanently unavailable</description>
- </state>
  <transition
     transition_id="close"
     title="Close"
@@ -1668,23 +1684,6 @@
     name="when_expired">object/ZopeTime</assignment>
  </transition>
  <transition
-    transition_id="open"
-    title="Open"
-    trigger="USER"
-    new_state="opened"
-    before_script="before_open"
-    after_script="">
-  <description>Open the object for modifications</description>
-  <action
-    category="workflow"
-    url="string:${object_url}/open_for_modifications">Open</action>
-  <guard>
-   <guard-permission>Open content for modifications</guard-permission>
-  </guard>
-  <assignment
-    name="when_opened">object/ZopeTime</assignment>
- </transition>
- <transition
     transition_id="kill"
     title="Kill"
     trigger="USER"
@@ -1701,6 +1700,23 @@
   <assignment
     name="killed_by">string:${user/getId}</assignment>
  </transition>
+ <transition
+    transition_id="open"
+    title="Open"
+    trigger="USER"
+    new_state="opened"
+    before_script="before_open"
+    after_script="">
+  <description>Open the object for modifications</description>
+  <action
+    category="workflow"
+    url="string:${object_url}/open_for_modifications">Open</action>
+  <guard>
+   <guard-permission>Open content for modifications</guard-permission>
+  </guard>
+  <assignment
+    name="when_opened">object/ZopeTime</assignment>
+ </transition>
  <worklist
     worklist_id="alive_list"
     title="Alive">
@@ -1916,7 +1932,7 @@
                               }
                           )
 
-        context._files[ 'workflows/%s/after_close.py' % workflow_filename 
+        context._files[ 'workflows/%s/after_close.py' % workflow_filename
                       ] = _AFTER_CLOSE_SCRIPT
 
         context._files[ 'workflows/%s/after_kill.py' % workflow_filename



More information about the CMF-checkins mailing list