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
303bb9fc
Commit
303bb9fc
authored
Jun 27, 2016
by
iv
Committed by
iv
Sep 20, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Workflow: improving testWorklist
parent
a81d5b6c
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
132 additions
and
163 deletions
+132
-163
bt5/erp5_workflow_test/TestTemplateItem/portal_components/test.erp5.testWorkflowMixin.py
...lateItem/portal_components/test.erp5.testWorkflowMixin.py
+10
-5
bt5/erp5_workflow_test/TestTemplateItem/portal_components/test.erp5.testWorklist.py
...tTemplateItem/portal_components/test.erp5.testWorklist.py
+118
-152
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+3
-5
product/ERP5Workflow/Document/Worklist.py
product/ERP5Workflow/Document/Worklist.py
+1
-1
No files found.
bt5/erp5_workflow_test/TestTemplateItem/portal_components/test.erp5.testWorkflowMixin.py
View file @
303bb9fc
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
class
testWorkflowMixin
(
ERP5TypeTestCase
):
def
getWorklistDocumentCountFromActionName
(
self
,
action_name
):
def
countFromActionName
(
self
,
action_name
):
# action_name look like: "Documents to validate (3)"
self
.
assertEqual
(
action_name
[
-
1
],
')'
)
left_parenthesis_offset
=
action_name
.
rfind
(
'('
)
self
.
assertNotEquals
(
left_parenthesis_offset
,
-
1
)
return
int
(
action_name
[
left_parenthesis_offset
+
1
:
-
1
])
def
checkWorklist
(
self
,
action_list
,
name
,
count
,
url_parameter_dict
=
None
,
workflow_id
=
None
):
def
checkWorklist
(
self
,
action_list
,
name
,
count
,
url_parameter_dict
=
None
,
workflow_id
=
None
,
selection_name
=
None
):
entry_list
=
[
x
for
x
in
action_list
if
x
[
'name'
].
startswith
(
name
)
and
(
...
...
@@ -16,19 +18,22 @@ class testWorkflowMixin(ERP5TypeTestCase):
and
x
[
'workflow_id'
]
==
workflow_id
)
]
# ensure there is a single entry in action list
self
.
assertEqual
(
len
(
entry_list
),
count
and
1
)
if
count
:
self
.
assertEqual
(
count
,
self
.
getWorklistDocumentC
ountFromActionName
(
entry_list
[
0
][
'name'
]))
self
.
c
ountFromActionName
(
entry_list
[
0
][
'name'
]))
if
entry_list
and
url_parameter_dict
:
url
=
entry_list
[
0
].
get
(
'url'
)
self
.
assertTrue
(
url
,
'Can not check url parameters without url'
)
url
=
'%s%s'
%
(
self
.
portal
.
getId
(),
url
[
len
(
self
.
portal
.
absolute_url
()):])
# Touch URL to save worklist parameters in listbox selection
self
.
publish
(
url
,
'manager:'
)
# XXX: troubles running live test, returns HTTP error 500
publish_response
=
self
.
publish
(
url
,
'manager:'
)
# XXX: troubles running live test, returns HTTP error 500
self
.
assertEqual
(
publish_response
.
status
,
200
)
self
.
commit
()
selection_parameter_dict
=
self
.
portal
.
portal_selections
.
getSelectionParamsFor
(
sel
f
.
module_sel
ection_name
)
selection_name
)
for
parameter
,
value
in
url_parameter_dict
.
iteritems
():
self
.
assertIn
(
parameter
,
selection_parameter_dict
)
self
.
assertEqual
(
value
,
selection_parameter_dict
[
parameter
])
...
...
bt5/erp5_workflow_test/TestTemplateItem/portal_components/test.erp5.testWorklist.py
View file @
303bb9fc
This diff is collapsed.
Click to expand it.
product/ERP5Workflow/Document/Workflow.py
View file @
303bb9fc
...
...
@@ -343,14 +343,12 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
portal
=
self
.
getPortalObject
()
def
getPortalTypeListForWorkflow
(
workflow_id
):
workflow_tool
=
portal
.
portal_workflow
result
=
[]
append
=
result
.
append
portal_type_list
=
[]
for
type_info
in
portal
.
portal_types
.
objectValues
():
portal_type
=
type_info
.
id
if
workflow_id
in
type_info
.
getTypeWorkflowList
():
append
(
portal_type
)
return
resul
t
portal_type_list
.
append
(
portal_type
)
return
portal_type_lis
t
_getPortalTypeListForWorkflow
=
CachingMethod
(
getPortalTypeListForWorkflow
,
id
=
'_getPortalTypeListForWorkflow'
,
cache_factory
=
'erp5_ui_long'
)
...
...
product/ERP5Workflow/Document/Worklist.py
View file @
303bb9fc
...
...
@@ -200,7 +200,7 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
matches_id
=
self
.
getMatchedCausalityState
()
matches_ref_list
.
append
(
matches_id
)
matches
=
tuple
(
matches_ref_list
)
el
se
:
el
if
id
:
# Local dynamic variable:
dynamic_varible
=
self
.
_getOb
(
'variable_'
+
id
)
if
dynamic_varible
.
getInitialValue
():
...
...
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