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
iv
erp5
Commits
1b86759a
Commit
1b86759a
authored
Aug 19, 2016
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Workflow: add test on Guards used in Interaction and Transition
parent
f5daca6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
6 deletions
+32
-6
product/ERP5Workflow/tests/testERP5Workflow.py
product/ERP5Workflow/tests/testERP5Workflow.py
+32
-6
No files found.
product/ERP5Workflow/tests/testERP5Workflow.py
View file @
1b86759a
...
...
@@ -176,14 +176,11 @@ class TestERP5Workflow(ERP5TypeTestCase):
# restrictive
def
test_beforeScript
(
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'
,
title
=
'State 1'
)
s2
=
workflow
.
newContent
(
portal_type
=
'State'
,
title
=
'State 2'
)
s1
=
workflow
.
newContent
(
portal_type
=
'State'
,
title
=
'State 1'
)
s2
=
workflow
.
newContent
(
portal_type
=
'State'
,
title
=
'State 2'
)
s1
.
setReference
(
's1'
)
s2
.
setReference
(
's2'
)
t1
=
workflow
.
newContent
(
portal_type
=
'Transition'
,
title
=
'Transition 1'
)
...
...
@@ -207,6 +204,35 @@ class TestERP5Workflow(ERP5TypeTestCase):
# FIXME: not passing parameter to an before script is probably too
# restrictive
def
test_TransitionGuards
(
self
,
transition_type
=
'Transition'
):
workflow_type
=
'Workflow'
if
transition_type
==
'Transition'
else
\
'Interaction Workflow'
workflow
=
self
.
workflow_module
.
newContent
(
portal_type
=
workflow_type
)
transition
=
workflow
.
newContent
(
portal_type
=
transition_type
)
# roles
transition
.
setGuardRoleList
([])
self
.
assertEqual
([],
transition
.
guard
.
roles
)
transition
.
setGuardRoleList
([
'Assignor'
,
'Assignee'
])
self
.
assertEqual
([
'Assignor'
,
'Assignee'
],
transition
.
guard
.
roles
)
# permissions
transition
.
setGuardPermissionList
([])
self
.
assertEqual
([],
transition
.
guard
.
permissions
)
transition
.
setGuardPermissionList
([
'Modify portal content'
])
self
.
assertEqual
([
'Modify portal content'
],
transition
.
guard
.
permissions
)
# groups
transition
.
setGuardGroupList
([])
self
.
assertEqual
([],
transition
.
guard
.
groups
)
transition
.
setGuardGroupList
([
'Group1'
,
'Group2'
])
self
.
assertEqual
([
'Group1'
,
'Group2'
],
transition
.
guard
.
groups
)
# expression
transition
.
setGuardExpression
(
''
)
self
.
assertEqual
(
None
,
transition
.
guard
.
expr
)
transition
.
setGuardExpression
(
'python: "Hello, world"'
)
self
.
assertEqual
(
transition
.
guard
.
expr
.
text
,
'python: "Hello, world"'
)
def
test_InteractionGuards
(
self
):
self
.
test_TransitionGuards
(
transition_type
=
'Interaction'
)
def
test_WorkflowSecurity
(
self
):
"""
Test workflow security. Should be test with other methods. To be finished.
...
...
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