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
Laurent S
erp5
Commits
f4adf7d3
Commit
f4adf7d3
authored
Jan 28, 2016
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: add a test to check guard existence in workflow transitions.
parent
34faa25a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
product/ERP5/tests/testSecurity.py
product/ERP5/tests/testSecurity.py
+19
-0
No files found.
product/ERP5/tests/testSecurity.py
View file @
f4adf7d3
...
...
@@ -109,6 +109,25 @@ class TestSecurityMixin(ERP5TypeTestCase):
%
(
len
(
error_list
),
'
\
n
\
t
'
.
join
([
'%s:%s %s'
%
x
for
x
in
sorted
(
error_list
)]))
self
.
fail
(
message
)
def
test_workflow_transition_protection
(
self
):
"""
This test will list all workflow transitions and check the existence of guard.
"""
error_list
=
[]
for
wf
in
self
.
portal
.
portal_workflow
.
objectValues
():
if
wf
.
__class__
.
__name__
==
'InteractionWorkflowDefinition'
:
continue
for
transition
in
wf
.
transitions
.
objectValues
():
if
getattr
(
transition
,
'trigger_type'
,
1
)
==
0
:
# Automatic transition without guard is safe
continue
if
getattr
(
transition
,
'guard'
,
None
)
is
None
:
error_list
.
append
(
'%s/transitions/%s'
%
(
wf
.
getId
(),
transition
.
getId
()))
if
error_list
:
message
=
'
\
n
The following %s workflow transitions are not guarded.
\
n
\
t
%s'
\
%
(
len
(
error_list
),
'
\
n
\
t
'
.
join
(
sorted
(
error_list
)))
self
.
fail
(
message
)
class
TestSecurity
(
TestSecurityMixin
):
def
getTitle
(
self
):
...
...
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