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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
546b35cc
Commit
546b35cc
authored
Jun 03, 2024
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! erp5_core_test: add a test for unconfigured Workflow State permissions.
parent
e67a0908
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
20 deletions
+22
-20
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBase.py
.../TestTemplateItem/portal_components/test.erp5.testBase.py
+0
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Workflow.py
...plateItem/portal_components/test.erp5.testERP5Workflow.py
+1
-1
bt5/erp5_workflow_test/TestTemplateItem/portal_components/test.erp5.testWorkflowAndDCWorkflow.py
.../portal_components/test.erp5.testWorkflowAndDCWorkflow.py
+21
-18
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBase.py
View file @
546b35cc
...
...
@@ -993,7 +993,6 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
user
=
getSecurityManager
().
getUser
()
try
:
self
.
assertTrue
(
permission_list
)
self
.
assertFalse
(
dummy_simulation_workflow
[
'state_draft'
].
getStatePermissionRoleListDict
())
#1
obj
=
module
.
newContent
(
portal_type
=
portal_type
)
#No role is defined by default on workflow
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Workflow.py
View file @
546b35cc
...
...
@@ -148,7 +148,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
self
.
assertEqual
(
workflow
.
getCurrentStatusDict
(
doc
)[
'variable1'
],
None
)
def
test_Workflow
Variable
s
(
self
):
def
test_Workflow
Permission
s
(
self
):
workflow
=
self
.
workflow_module
.
newContent
(
portal_type
=
'Workflow'
,
)
...
...
bt5/erp5_workflow_test/TestTemplateItem/portal_components/test.erp5.testWorkflowAndDCWorkflow.py
View file @
546b35cc
...
...
@@ -294,10 +294,6 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
workflow
.
updateRoleMappingsFor
(
text_document
)
self
.
assertEqual
(
getattr
(
text_document
,
permission_key
),
[
'Assignor'
,
'Auditor'
])
# remove permission from the workflow, it should be removed from state
workflow
.
setWorkflowManagedPermissionList
([])
self
.
assertEqual
(
workflow
.
state_current
.
getAcquirePermissionList
(),
[])
# check the permissions are saved sorted in a canonical form: sorted and as
# tuple
workflow
.
state_current
.
setPermission
(
permission
,
[
'Auditor'
,
'Assignor'
])
...
...
@@ -305,6 +301,10 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
workflow
.
state_current
.
getStatePermissionRoleListDict
().
get
(
permission
),
(
'Assignor'
,
'Auditor'
))
# remove permission from the workflow, it should be removed from state
workflow
.
setWorkflowManagedPermissionList
([])
self
.
assertEqual
(
workflow
.
state_current
.
getAcquirePermissionList
(),
[])
def
test_14_multiple_workflow_different_permission_roles
(
self
):
workflow1
=
self
.
createERP5Workflow
(
'edit_workflow'
,
'temporary_workflow1'
)
workflow2
=
self
.
createERP5Workflow
(
'edit_workflow'
,
'temporary_workflow2'
)
...
...
@@ -395,9 +395,8 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
# create document
text_document1
=
self
.
getTestObject
()
text_document1_permission
=
getattr
(
text_document1
,
permission_key
,
None
)
# self.assertEqual(getattr(text_document1, permission_key),
# ['Assignee', 'Assignor', 'Auditor', 'Author'])
self
.
assertEqual
(
text_document1_permission
,
(
'Assignor'
,
'Assignee'
,
'Auditor'
,
'Author'
))
# add the second workflow
text_portal_type
.
setTypeWorkflowList
([
'temporary_dc_workflow1'
,
'temporary_dc_workflow2'
])
...
...
@@ -405,9 +404,7 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
# create document
text_document2
=
self
.
getTestObject
()
text_document2_permission
=
getattr
(
text_document2
,
permission_key
,
None
)
# self.assertEqual(getattr(text_document2, permission_key),
# ['Assignee', 'Assignor', 'Auditor', 'Author'])
self
.
assertEqual
(
text_document2_permission
,
None
)
# migrate workflows
self
.
portal
.
portal_workflow
.
WorkflowTool_convertWorkflow
(
...
...
@@ -416,15 +413,21 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
)
self
.
tic
()
# create another document
text_document3
=
self
.
getTestObject
()
text_document3_permission
=
getattr
(
text_document3
,
permission_key
,
None
)
# with only one workflow
text_portal_type
.
setTypeWorkflowList
([
'temporary_dc_workflow1'
])
print
(
'text_document1_permission: %r'
%
(
text_document1_permission
,
))
print
(
'text_document2_permission: %r'
%
(
text_document2_permission
,
))
print
(
'text_document3_permission: %r'
%
(
text_document3_permission
,
))
self
.
assertEqual
(
tuple
(
getattr
(
text_document3
,
permission_key
)),
(
'Assignee'
,
'Assignor'
,
'Auditor'
,
'Author'
))
# create document
text_document1a
=
self
.
getTestObject
()
text_document1a_permission
=
getattr
(
text_document1a
,
permission_key
,
None
)
self
.
assertSameSet
(
text_document1a_permission
,
text_document1_permission
)
# add the second workflow
text_portal_type
.
setTypeWorkflowList
([
'temporary_dc_workflow1'
,
'temporary_dc_workflow2'
])
# create document
text_document2a
=
self
.
getTestObject
()
text_document2a_permission
=
getattr
(
text_document2a
,
permission_key
,
None
)
self
.
assertEqual
(
text_document2a_permission
,
text_document2_permission
)
def
test_16_testWorklistViewIsAccessible
(
self
):
# check worklist view is available on workflow
...
...
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