Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Titouan Soulard
erp5
Commits
e9630ba1
Commit
e9630ba1
authored
Nov 27, 2014
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_core: Deploy workflow_list to access Workflow5 in testERP5Workflow
parent
0b06ab6e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
14 deletions
+19
-14
product/ERP5/bootstrap/erp5_core/TestTemplateItem/portal_components/test.erp5.testERP5Workflow.py
...plateItem/portal_components/test.erp5.testERP5Workflow.py
+19
-14
No files found.
product/ERP5/bootstrap/erp5_core/TestTemplateItem/portal_components/test.erp5.testERP5Workflow.py
View file @
e9630ba1
...
...
@@ -67,10 +67,8 @@ class TestERP5Workflow(ERP5TypeTestCase):
def
test_Erp5Workflow
(
self
):
"""Tests the connection between ERP5Workflow and Objects."""
# Create base category as the intermidiate
self
.
portal
.
portal_categories
.
newContent
(
'category_state'
)
#self.portal.portal_categories.newContent('erp5_workflow')
# Create a workflow
new_workflow
=
self
.
workflow_module
.
newContent
(
portal_type
=
'Workflow'
,
id
=
'new_workflow'
)
...
...
@@ -87,7 +85,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
new_workflow
.
setStateBaseCategory
(
'category_state'
)
# create a base type and a portal type based on this base type
type_object
=
self
.
portal
.
portal_types
.
newContent
(
portal_type
=
'Base Type'
,
id
=
'Object Type'
,
...
...
@@ -97,6 +95,9 @@ class TestERP5Workflow(ERP5TypeTestCase):
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
.
getWorkflow5
(),
'workflow_module/new_workflow'
)
...
...
@@ -118,23 +119,24 @@ class TestERP5Workflow(ERP5TypeTestCase):
self
.
assertEqual
(
new_object
.
getPortalType
(),
"Object Type"
)
self
.
assertEqual
(
new_object
.
getPortalType
(),
'Object Type'
)
self
.
assertEqual
(
new_object
.
getCategoryStateTitle
(),
'State 1'
)
def
test_Erp5Transition
(
self
):
"""Tests ERP5Workflow transition"""
# Create base category as the intermidiate
self
.
portal
.
portal_categories
.
newContent
(
'category_state'
)
self
.
portal
.
portal_categories
.
newContent
(
'category_transition'
)
# Create a workflow
new_workflow
=
self
.
workflow_module
.
newContent
(
portal_type
=
'Workflow'
,
id
=
'new_workflow'
)
s1
=
new_workflow
.
newContent
(
portal_type
=
'State'
,
title
=
'State 1'
)
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'
,
id
=
'transition1'
)
t2
=
new_workflow
.
newContent
(
portal_type
=
'Transition'
,
t2
=
new_workflow
.
newContent
(
portal_type
=
'Transition'
,
title
=
'Transition 2'
,
id
=
'transition2'
)
s1
.
setDestinationValue
(
t1
)
...
...
@@ -149,7 +151,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
new_workflow
.
setStateBaseCategory
(
'category_state'
,
'category_transition'
)
# create a base type and a portal type based on this base type
type_object
=
self
.
portal
.
portal_types
.
newContent
(
portal_type
=
'Base Type'
,
id
=
'Object Type'
,
...
...
@@ -158,6 +160,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
)
type_object
.
setWorkflow5Value
(
new_workflow
)
type_object
.
workflow_list
=
(
'new_workflow'
,)
self
.
assertEqual
(
type_object
.
getBaseCategoryList
(),
[
'workflow5'
])
self
.
assertEqual
(
type_object
.
getWorkflow5
(),
...
...
@@ -179,7 +182,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
self
.
assertTrue
(
new_object
is
not
None
)
self
.
assertEqual
(
new_object
.
getPortalType
(),
'Object Type'
)
self
.
assertEqual
(
new_object
.
getCategoryStateTitle
(),
'State 1'
)
# Pass transition
"""Method 1"""
t1
.
execute
(
new_object
)
...
...
@@ -193,14 +196,16 @@ class TestERP5Workflow(ERP5TypeTestCase):
self
.
assertEqual
(
new_object
.
getCategoryStateTitle
(),
'State 1'
)
"""Method 3"""
new_object
.
getCategoryStateValue
().
executeTransition
(
new_workflow
.
transition1
,
new_workflow
.
transition1
,
new_object
)
self
.
assertEqual
(
new_object
.
getCategoryStateTitle
(),
'State 2'
)
new_object
.
getCategoryStateValue
().
executeTransition
(
new_workflow
.
transition2
,
new_workflow
.
transition2
,
new_object
)
self
.
assertEqual
(
new_object
.
getCategoryStateTitle
(),
'State 1'
)
#new_object.transition1()
#self.assertEqual(new_object.getCategoryStateTitle(), 'State 2')
#new_object.transition2a1()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment