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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
erp5
Commits
51154039
Commit
51154039
authored
Aug 18, 2016
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Workflow: cosmetics + add XXX
parent
25120fff
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
18 deletions
+25
-18
product/ERP5Workflow/tests/testERP5Workflow.py
product/ERP5Workflow/tests/testERP5Workflow.py
+25
-18
No files found.
product/ERP5Workflow/tests/testERP5Workflow.py
View file @
51154039
...
...
@@ -68,15 +68,15 @@ class TestERP5Workflow(ERP5TypeTestCase):
s1
.
setReference
(
's1'
)
s2
.
setReference
(
's2'
)
t1
=
workflow
.
newContent
(
portal_type
=
'Transition'
,
title
=
'Transition 1'
,
)
title
=
'Transition 1'
)
t1
.
setReference
(
't1'
)
s1
.
setDestinationValue
(
t1
)
t1
.
setDestinationValue
(
s2
)
# set initial state
workflow
.
setSourceValue
(
s1
)
# create a document and associate it to this workflow
self
.
getPortalObject
().
portal_types
.
_getOb
(
'Folder'
).
edit
(
type_workflow_list
=
(
'wf'
))
self
.
getPortalObject
().
portal_types
.
_getOb
(
'Folder'
)
\
.
edit
(
type_workflow_list
=
(
'wf'
))
doc
=
self
.
portal
.
newContent
(
portal_type
=
'Folder'
,
id
=
'test_doc'
)
self
.
assertEqual
(
's1'
,
workflow
.
_getWorkflowStateOf
(
doc
,
id_only
=
1
))
...
...
@@ -86,8 +86,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
def
test_getAvailableTransitionList
(
self
):
workflow
=
self
.
workflow_module
.
newContent
(
portal_type
=
'Workflow'
)
workflow
=
self
.
workflow_module
.
newContent
(
portal_type
=
'Workflow'
)
workflow
.
setReference
(
'wf'
)
workflow
.
setStateVariable
(
'current_state'
)
s1
=
workflow
.
newContent
(
portal_type
=
'State'
,
...
...
@@ -103,7 +102,8 @@ class TestERP5Workflow(ERP5TypeTestCase):
t2
.
setReference
(
't2'
)
s1
.
setDestinationValueList
([
t1
,
t2
])
self
.
getPortalObject
().
portal_types
.
_getOb
(
'Folder'
).
edit
(
type_workflow_list
=
(
'wf'
))
self
.
getPortalObject
().
portal_types
.
_getOb
(
'Folder'
)
\
.
edit
(
type_workflow_list
=
(
'wf'
))
doc
=
self
.
portal
.
newContent
(
portal_type
=
'Folder'
,
id
=
'test_doc'
)
self
.
assertEqual
([
t1
,
t2
],
s1
.
getDestinationValueList
())
...
...
@@ -127,7 +127,8 @@ class TestERP5Workflow(ERP5TypeTestCase):
title
=
'actor'
)
v1
.
setReference
(
'actor'
)
v1
.
variable_expression
=
'user/getUserName'
self
.
getPortalObject
().
portal_types
.
_getOb
(
'Folder'
).
edit
(
type_workflow_list
=
(
'wf'
))
self
.
getPortalObject
().
portal_types
.
_getOb
(
'Folder'
)
\
.
edit
(
type_workflow_list
=
(
'wf'
))
doc
=
self
.
portal
.
newContent
(
portal_type
=
'Folder'
,
id
=
'test_doc'
)
workflow
.
_executeTransition
(
doc
,
t1
)
current_state
=
workflow
.
getCurrentStatusDict
(
doc
)
...
...
@@ -142,7 +143,8 @@ class TestERP5Workflow(ERP5TypeTestCase):
def
test_afterScript
(
self
):
workflow
=
self
.
workflow_module
.
newContent
(
portal_type
=
'Workflow'
,
state_base_category
=
'current_state'
)
state_base_category
=
'current_state'
)
workflow
.
setReference
(
'wf'
)
s1
=
workflow
.
newContent
(
portal_type
=
'State'
,
title
=
'State 1'
)
...
...
@@ -152,17 +154,19 @@ class TestERP5Workflow(ERP5TypeTestCase):
s2
.
setReference
(
's2'
)
t1
=
workflow
.
newContent
(
portal_type
=
'Transition'
,
title
=
'Transition 1'
,
after_script_id
=
'Document_testAfterScript'
,
)
after_script_id
=
'Document_testAfterScript'
)
t1
.
setReference
(
't1'
)
s1
.
setDestinationValue
(
t1
)
t1
.
setDestinationValue
(
s2
)
workflow
.
setSourceValue
(
s1
)
script
=
workflow
.
newContent
(
portal_type
=
'Workflow Script'
,
id
=
'Document_testAfterScript'
)
script
=
workflow
.
newContent
(
portal_type
=
'Workflow Script'
,
id
=
'Document_testAfterScript'
)
script
.
setParameterSignature
(
"state_change"
)
script
.
setParameterSignature
(
"state_change"
)
script
.
setBody
(
"state_change['object'].setDescription('After script was executed.')"
)
self
.
getPortalObject
().
portal_types
.
_getOb
(
'Folder'
).
edit
(
type_workflow_list
=
(
'wf'
))
script
.
setBody
(
"state_change['object'].setDescription('After script was "
+
"executed.')"
)
self
.
getPortalObject
().
portal_types
.
_getOb
(
'Folder'
)
\
.
edit
(
type_workflow_list
=
(
'wf'
))
doc
=
self
.
portal
.
newContent
(
portal_type
=
'Folder'
,
id
=
'test_doc'
)
workflow
.
_executeTransition
(
doc
,
t1
)
...
...
@@ -189,11 +193,14 @@ class TestERP5Workflow(ERP5TypeTestCase):
s1
.
setDestinationValue
(
t1
)
t1
.
setDestinationValue
(
s2
)
workflow
.
setSourceValue
(
s1
)
script
=
workflow
.
newContent
(
portal_type
=
'Workflow Script'
,
id
=
'Document_testBeforeScript'
)
script
=
workflow
.
newContent
(
portal_type
=
'Workflow Script'
,
id
=
'Document_testBeforeScript'
)
script
.
setParameterSignature
(
"state_change"
)
script
.
setBody
(
"state_change['object'].setDescription('Before script was executed.')"
)
script
.
setBody
(
"state_change['object'].setDescription('Before script was "
+
"executed.')"
)
self
.
getPortalObject
().
portal_types
.
_getOb
(
'Folder'
).
edit
(
type_workflow_list
=
(
'wf'
))
self
.
getPortalObject
().
portal_types
.
_getOb
(
'Folder'
)
\
.
edit
(
type_workflow_list
=
(
'wf'
))
doc
=
self
.
portal
.
newContent
(
portal_type
=
'Folder'
,
id
=
'test_doc'
)
workflow
.
_executeTransition
(
doc
,
t1
)
...
...
@@ -220,7 +227,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
#self.assertRaises(Unauthorized, workflow_module.view)
#self.assertRaises(Unauthorized, createWorkflowInstance)
#self.assertRaises(Unauthorized, lambda: workflow_instance.view())
# XXX(WORKFLOW): why is this commented? ^
def
test_suite
():
suite
=
unittest
.
TestSuite
()
...
...
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