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
4d78759b
Commit
4d78759b
authored
Aug 05, 2016
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Workflow: fix test by using guard_ prefix (see new Guard property sheet) +
fix Workflow creation/removal
parent
0985c2ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testWorklist.py
...tTemplateItem/portal_components/test.erp5.testWorklist.py
+16
-11
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testWorklist.py
View file @
4d78759b
...
...
@@ -49,6 +49,8 @@ class TestWorklist(testWorkflowMixin):
self
.
createERP5Users
()
self
.
clearCache
()
self
.
tic
()
self
.
removeWorklist
(
'validation_workflow'
,
self
.
test_worklist_dict
.
keys
())
self
.
tic
()
def
beforeTearDown
(
self
):
self
.
cleanUp
()
...
...
@@ -126,7 +128,9 @@ class TestWorklist(testWorkflowMixin):
if
workflow_value
.
__class__
.
__name__
==
'Workflow'
:
if
getattr
(
workflow_value
,
worklist_id
,
None
):
workflow_value
.
manage_delObjects
([
worklist_id
])
worklist_value
=
workflow_value
.
newContent
(
portal_type
=
'Worklist'
)
worklist_value
=
getattr
(
workflow_value
,
'worklist_%s'
%
worklist_id
,
None
)
if
worklist_value
is
None
:
worklist_value
=
workflow_value
.
newContent
(
portal_type
=
'Worklist'
)
guard_roles
=
[]
if
not
guard_roles
else
[
role
.
strip
()
for
role
in
guard_roles
.
split
(
';'
)]
# XXX(WORKFLOW), it would be much nicer to use categories instead of ids like 'state_draft',
# this way we would be consistent with what is used in transitions
...
...
@@ -139,8 +143,8 @@ class TestWorklist(testWorkflowMixin):
actbox_category
=
'global'
,
matched_validation_state
=
validation_state
,
matched_portal_type_list
=
portal_type
,
role_list
=
guard_roles
,
expression
=
guard_expr
guard_
role_list
=
guard_roles
,
guard_
expression
=
guard_expr
)
for
worklist_variable_key
,
worklist_variable_value
in
kw
.
iteritems
():
...
...
@@ -168,7 +172,10 @@ class TestWorklist(testWorkflowMixin):
workflow_value
=
self
.
getWorkflowTool
()[
workflow_id
]
if
workflow_value
.
__class__
.
__name__
==
'Workflow'
:
for
worklist_id
in
worklist_id_list
:
workflow_value
.
_delObject
(
'worklist_'
+
worklist_id
)
try
:
workflow_value
.
_delObject
(
'worklist_'
+
worklist_id
)
except
KeyError
:
pass
else
:
worklists
=
self
.
getWorkflowTool
()[
workflow_id
].
worklists
worklists
.
deleteWorklists
(
worklist_id_list
)
...
...
@@ -212,7 +219,6 @@ class TestWorklist(testWorkflowMixin):
try
:
self
.
logMessage
(
"Create document as Manager"
)
document
=
self
.
createDocument
()
self
.
tic
()
self
.
clearCache
()
...
...
@@ -221,9 +227,9 @@ class TestWorklist(testWorkflowMixin):
self
.
login
(
user_id
)
result
=
workflow_tool
.
listActions
(
object
=
document
)
self
.
logMessage
(
"Check
%s worklist as Assignor
"
%
user_id
)
self
.
logMessage
(
"Check
Assignor worklist as %s
"
%
user_id
)
self
.
checkWorklist
(
result
,
'assignor_todo'
,
0
)
self
.
logMessage
(
"Check
%s worklist as Owner
"
%
user_id
)
self
.
logMessage
(
"Check
Owner worklist as %s
"
%
user_id
)
self
.
checkWorklist
(
result
,
'owner_todo'
,
1
)
for
user_id
in
(
'foo'
,
'bar'
):
self
.
logMessage
(
"Check %s worklist"
%
user_id
)
...
...
@@ -246,11 +252,11 @@ class TestWorklist(testWorkflowMixin):
(
'foo'
,
1
,
0
,
1
)):
self
.
login
(
user_id
)
result
=
workflow_tool
.
listActions
(
object
=
document
)
self
.
logMessage
(
" Check
%s worklist as Assignor
"
%
user_id
)
self
.
logMessage
(
" Check
Assignor worklist as %s
"
%
user_id
)
self
.
checkWorklist
(
result
,
'assignor_todo'
,
assignor
)
self
.
logMessage
(
" Check
%s worklist as Owner
"
%
user_id
)
self
.
logMessage
(
" Check
Owner worklist as %s
"
%
user_id
)
self
.
checkWorklist
(
result
,
'owner_todo'
,
owner
)
self
.
logMessage
(
" Check
%s worklist as Owner and Assignor
"
%
user_id
)
self
.
logMessage
(
" Check
Owner and Assignor worklist as %s
"
%
user_id
)
self
.
checkWorklist
(
result
,
'assignor_owner_todo'
,
both
)
# Check if int variable are managed by the worklist
...
...
@@ -324,7 +330,6 @@ class TestWorklist(testWorkflowMixin):
current_sql_catalog_local_role_keys
self
.
commit
()
finally
:
self
.
removeWorklist
(
'validation_workflow'
,
self
.
test_worklist_dict
.
keys
())
self
.
commit
()
def
test_02_related_key
(
self
,
quiet
=
0
,
run
=
run_all_test
):
...
...
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