Commit e9630ba1 authored by wenjie.zheng's avatar wenjie.zheng

erp5_core: Deploy workflow_list to access Workflow5 in testERP5Workflow

parent 0b06ab6e
...@@ -67,9 +67,7 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -67,9 +67,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
def test_Erp5Workflow(self): def test_Erp5Workflow(self):
"""Tests the connection between ERP5Workflow and Objects.""" """Tests the connection between ERP5Workflow and Objects."""
# Create base category as the intermidiate # Create base category as the intermidiate
self.portal.portal_categories.newContent('category_state') self.portal.portal_categories.newContent('category_state')
#self.portal.portal_categories.newContent('erp5_workflow')
# Create a workflow # Create a workflow
new_workflow = self.workflow_module.newContent(portal_type='Workflow', new_workflow = self.workflow_module.newContent(portal_type='Workflow',
...@@ -97,6 +95,9 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -97,6 +95,9 @@ class TestERP5Workflow(ERP5TypeTestCase):
type_object.setWorkflow5Value(new_workflow) type_object.setWorkflow5Value(new_workflow)
#use variable in ERP5Type.py, to avoid using no-exist accessor
type_object.workflow_list=('new_workflow',)
self.assertEqual(type_object.getBaseCategoryList(), ['workflow5']) self.assertEqual(type_object.getBaseCategoryList(), ['workflow5'])
self.assertEqual(type_object.getWorkflow5(), self.assertEqual(type_object.getWorkflow5(),
'workflow_module/new_workflow') 'workflow_module/new_workflow')
...@@ -122,7 +123,6 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -122,7 +123,6 @@ class TestERP5Workflow(ERP5TypeTestCase):
def test_Erp5Transition(self): def test_Erp5Transition(self):
"""Tests ERP5Workflow transition""" """Tests ERP5Workflow transition"""
# Create base category as the intermidiate # Create base category as the intermidiate
self.portal.portal_categories.newContent('category_state') self.portal.portal_categories.newContent('category_state')
self.portal.portal_categories.newContent('category_transition') self.portal.portal_categories.newContent('category_transition')
...@@ -131,10 +131,12 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -131,10 +131,12 @@ class TestERP5Workflow(ERP5TypeTestCase):
id='new_workflow') id='new_workflow')
s1 = new_workflow.newContent(portal_type='State',title='State 1') s1 = new_workflow.newContent(portal_type='State',title='State 1')
s2 = new_workflow.newContent(portal_type='State',title='State 2') s2 = new_workflow.newContent(portal_type='State',title='State 2')
t1 = new_workflow.newContent(portal_type='Transition', t1 = new_workflow.newContent(
portal_type='Transition',
title='Transition 1', title='Transition 1',
id='transition1') id='transition1')
t2 = new_workflow.newContent(portal_type='Transition', t2 = new_workflow.newContent(
portal_type='Transition',
title='Transition 2', title='Transition 2',
id='transition2') id='transition2')
s1.setDestinationValue(t1) s1.setDestinationValue(t1)
...@@ -158,6 +160,7 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -158,6 +160,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
) )
type_object.setWorkflow5Value(new_workflow) type_object.setWorkflow5Value(new_workflow)
type_object.workflow_list=('new_workflow',)
self.assertEqual(type_object.getBaseCategoryList(), ['workflow5']) self.assertEqual(type_object.getBaseCategoryList(), ['workflow5'])
self.assertEqual(type_object.getWorkflow5(), self.assertEqual(type_object.getWorkflow5(),
...@@ -201,6 +204,8 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -201,6 +204,8 @@ class TestERP5Workflow(ERP5TypeTestCase):
new_object) new_object)
self.assertEqual(new_object.getCategoryStateTitle(), 'State 1') self.assertEqual(new_object.getCategoryStateTitle(), 'State 1')
#new_object.transition1()
#self.assertEqual(new_object.getCategoryStateTitle(), 'State 2')
#new_object.transition2a1() #new_object.transition2a1()
......
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