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
4bcaf09e
Commit
4bcaf09e
authored
Sep 06, 2016
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Workflow: improve permission test on workflow states
parent
8611120f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
25 deletions
+10
-25
bt5/erp5_workflow_test/TestTemplateItem/portal_components/test.erp5.testWorkflowAndDCWorkflow.py
.../portal_components/test.erp5.testWorkflowAndDCWorkflow.py
+10
-25
No files found.
bt5/erp5_workflow_test/TestTemplateItem/portal_components/test.erp5.testWorkflowAndDCWorkflow.py
View file @
4bcaf09e
...
...
@@ -221,7 +221,6 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
"""
portal_workflow
=
self
.
portal
.
portal_workflow
self
.
logMessage
(
" Save portal type original configuration"
)
text_portal_type
=
self
.
portal
.
portal_types
.
_getOb
(
'Workflow Test Document'
)
temporary_workflow_id
=
'temporary_edit_workflow'
...
...
@@ -233,60 +232,46 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
permission
=
'View management screens'
permission_key
=
'_'
+
permission
.
replace
(
' '
,
'_'
)
+
'_Permission'
self
.
logMessage
(
" Create a Workflow Test document: it will have the usual"
+
" permissions defined by edit_workflow"
)
# create a Workflow Test document: it will have the usual permissions
# defined by edit_workflow
text_document
=
self
.
getTestObject
()
self
.
logMessage
(
" Verify that the permission '"
+
permission
+
"' is not "
+
"declared on the text document yet"
)
# Verify that the permission 'View management screens' is not declared on
# the text document yet
self
.
assertFalse
(
getattr
(
text_document
,
permission_key
,
False
))
workflow
=
portal_workflow
.
_getOb
(
temporary_workflow_id
)
# XXX(WORFKLOW): remove this code block once merged into erp5 master
if
workflow
.
getPortalType
()
!=
'Workflow'
:
self
.
logMessage
(
" Converting workflow "
+
temporary_workflow_id
)
portal_workflow
.
WorkflowTool_convertWorkflow
(
batch_mode
=
True
,
workflow_id_list
=
[
temporary_workflow_id
]
)
self
.
tic
()
workflow
=
portal_workflow
.
_getOb
(
temporary_workflow_id
)
self
.
assertEqual
(
workflow
.
getPortalType
(),
'Workflow'
)
self
.
logMessage
(
" Changing permission list to: %s"
%
[
permission
])
workflow
.
setWorkflowManagedPermissionList
([
permission
])
self
.
tic
()
self
.
logMessage
(
" Verify permission roles dict on 'current' state"
)
# Verify permission roles dict on 'current' state"
permission_roles_dict
=
workflow
.
state_current
\
.
getStatePermissionRolesDict
()
self
.
assertIn
(
permission
,
permission_roles_dict
)
self
.
logMessage
(
" Change roles for '"
+
permission
+
"' on state and update role list for permission"
)
# change roles and update permission/roles mapping on text_document
# and check document permissions/roles mapping was updated
# it should be a tuple, as there is no acquisition (otherwise a list)
permission_roles_dict
[
permission
]
=
[
'Assignor'
]
workflow
.
state_current
.
setAcquirePermissionList
([])
workflow
.
updateRoleMappingsFor
(
text_document
)
self
.
tic
()
self
.
logMessage
(
" Check document permissions/roles mapping was updated "
+
"(it should be a tuple, as there is no acquisition)"
)
self
.
assertEqual
(
getattr
(
text_document
,
permission_key
),
(
'Assignor'
,))
self
.
logMessage
(
" Configure acquisition for '"
+
permission
+
"' on state and update role list for permission"
)
# set acquisition and verify that permission/roles mapping is now a list
workflow
.
state_current
.
setAcquirePermissionList
([
permission
])
workflow
.
updateRoleMappingsFor
(
text_document
)
self
.
tic
()
self
.
logMessage
(
" Check document permissions/roles mapping is now"
+
" a list (acquisition)"
)
self
.
assertEqual
(
getattr
(
text_document
,
permission_key
),
[
'Assignor'
])
self
.
logMessage
(
" Restore original configuration"
)
portal_workflow
.
manage_delObjects
(
temporary_workflow_id
)
class
TestDCWorkflow
(
TestERP5WorkflowMixin
):
"""
Check DC Workflow works correctly in new Workflow Tool.
...
...
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