Commit 425949fe authored by wenjie.zheng's avatar wenjie.zheng

erp5_core: Change my testERP5Workflow's name to testWorkflow5.

parent adce6926
...@@ -72,33 +72,6 @@ ...@@ -72,33 +72,6 @@
<key> <string>action</string> </key> <key> <string>action</string> </key>
<value> <string>validate</string> </value> <value> <string>validate</string> </value>
</item> </item>
<item>
<key> <string>actor</string> </key>
<value> <string>ERP5TypeTestCase</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1377844421.32</float>
<string>GMT+9</string>
</tuple>
</state>
</object>
</value>
</item>
<item> <item>
<key> <string>validation_state</string> </key> <key> <string>validation_state</string> </key>
<value> <string>validated</string> </value> <value> <string>validated</string> </value>
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
import unittest import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Acquisition import aq_get
class TestERP5Workflow(ERP5TypeTestCase): class TestERP5Workflow(ERP5TypeTestCase):
""" """
...@@ -161,6 +162,7 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -161,6 +162,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
type_object.setWorkflow5Value(new_workflow) type_object.setWorkflow5Value(new_workflow)
type_object.workflow_list=('new_workflow',) type_object.workflow_list=('new_workflow',)
#type_object.setProperty('Transition_2', new_workflow)
self.assertEqual(type_object.getBaseCategoryList(), ['workflow5']) self.assertEqual(type_object.getBaseCategoryList(), ['workflow5'])
self.assertEqual(type_object.getWorkflow5(), self.assertEqual(type_object.getWorkflow5(),
...@@ -179,22 +181,24 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -179,22 +181,24 @@ class TestERP5Workflow(ERP5TypeTestCase):
# create an object based on new-created portal type in the module # create an object based on new-created portal type in the module
new_object = self.portal.new_module.newContent(portal_type='Object Type', new_object = self.portal.new_module.newContent(portal_type='Object Type',
id='new_object') id='new_object')
new_object.setCategoryTransitionValue(t2)
self.assertTrue(new_object is not None) self.assertTrue(new_object is not None)
self.assertEqual(new_object.getPortalType(), 'Object Type') self.assertEqual(new_object.getPortalType(), 'Object Type')
self.assertEqual(new_object.getCategoryStateTitle(), 'State 1') self.assertEqual(new_object.getCategoryStateTitle(), 'State 1')
# Pass transition # Pass transition
"""Method 1""" # Method 1: transition level with base_category
t1.execute(new_object) t1.execute(new_object)
self.assertEqual(new_object.getCategoryStateTitle(), 'State 2') self.assertEqual(new_object.getCategoryStateTitle(), 'State 2')
t2.execute(new_object) t2.execute(new_object)
self.assertEqual(new_object.getCategoryStateTitle(), 'State 1') self.assertEqual(new_object.getCategoryStateTitle(), 'State 1')
"""Method 2""" # Method 2: state level with base_category
s1.executeTransition(t1, new_object) s1.executeTransition(t1, new_object)
self.assertEqual(new_object.getCategoryStateTitle(), 'State 2') self.assertEqual(new_object.getCategoryStateTitle(), 'State 2')
s2.executeTransition(t2, new_object) s2.executeTransition(t2, new_object)
self.assertEqual(new_object.getCategoryStateTitle(), 'State 1') self.assertEqual(new_object.getCategoryStateTitle(), 'State 1')
"""Method 3""" # Method 3: object level with base_category
new_object.getCategoryStateValue().executeTransition( new_object.getCategoryStateValue().executeTransition(
new_workflow.transition1, new_workflow.transition1,
new_object) new_object)
...@@ -204,6 +208,15 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -204,6 +208,15 @@ class TestERP5Workflow(ERP5TypeTestCase):
new_object) new_object)
self.assertEqual(new_object.getCategoryStateTitle(), 'State 1') self.assertEqual(new_object.getCategoryStateTitle(), 'State 1')
# Method 4: object level with workflow_list
new_object.getDefaultModule(portal_type="Workflow")._getOb('new_workflow').transition1.execute(new_object)
self.assertEqual(new_object.getCategoryStateTitle(), 'State 2')
#new_object.getDefaultModule(portal_type="Workflow")._getOb('new_workflow').transition2.execute(new_object)
aq_get(new_object, 'workflow_module', 1)._getOb(type_object.workflow_list[0]).transition2.execute(new_object)
# getToolByName(new_object, 'new_workflow').transition2.execute(new_object) # marche pas
#new_object.Transition1.execute(new_object)
self.assertEqual(new_object.getCategoryStateTitle(), 'State 1')
#new_object.transition1() #new_object.transition1()
#self.assertEqual(new_object.getCategoryStateTitle(), 'State 2') #self.assertEqual(new_object.getCategoryStateTitle(), 'State 2')
#new_object.transition2a1() #new_object.transition2a1()
......
...@@ -8,15 +8,17 @@ ...@@ -8,15 +8,17 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testERP5Workflow</string> </value> <value> <string>testWorkflow5</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Test ERP5 workflow</string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testERP5Workflow</string> </value> <value> <string>test.erp5.testWorkflow5</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
......
test.erp5.testActivityTool test.erp5.testActivityTool
test.erp5.testERP5Workflow test.erp5.testWorkflow5
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment