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
Léo-Paul Géneau
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):
...
@@ -993,7 +993,6 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
user
=
getSecurityManager
().
getUser
()
user
=
getSecurityManager
().
getUser
()
try
:
try
:
self
.
assertTrue
(
permission_list
)
self
.
assertTrue
(
permission_list
)
self
.
assertFalse
(
dummy_simulation_workflow
[
'state_draft'
].
getStatePermissionRoleListDict
())
#1
#1
obj
=
module
.
newContent
(
portal_type
=
portal_type
)
obj
=
module
.
newContent
(
portal_type
=
portal_type
)
#No role is defined by default on workflow
#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):
...
@@ -148,7 +148,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
self
.
assertEqual
(
workflow
.
getCurrentStatusDict
(
doc
)[
'variable1'
],
None
)
self
.
assertEqual
(
workflow
.
getCurrentStatusDict
(
doc
)[
'variable1'
],
None
)
def
test_Workflow
Variable
s
(
self
):
def
test_Workflow
Permission
s
(
self
):
workflow
=
self
.
workflow_module
.
newContent
(
workflow
=
self
.
workflow_module
.
newContent
(
portal_type
=
'Workflow'
,
portal_type
=
'Workflow'
,
)
)
...
...
bt5/erp5_workflow_test/TestTemplateItem/portal_components/test.erp5.testWorkflowAndDCWorkflow.py
View file @
546b35cc
...
@@ -294,10 +294,6 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
...
@@ -294,10 +294,6 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
workflow
.
updateRoleMappingsFor
(
text_document
)
workflow
.
updateRoleMappingsFor
(
text_document
)
self
.
assertEqual
(
getattr
(
text_document
,
permission_key
),
[
'Assignor'
,
'Auditor'
])
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
# check the permissions are saved sorted in a canonical form: sorted and as
# tuple
# tuple
workflow
.
state_current
.
setPermission
(
permission
,
[
'Auditor'
,
'Assignor'
])
workflow
.
state_current
.
setPermission
(
permission
,
[
'Auditor'
,
'Assignor'
])
...
@@ -305,6 +301,10 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
...
@@ -305,6 +301,10 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
workflow
.
state_current
.
getStatePermissionRoleListDict
().
get
(
permission
),
workflow
.
state_current
.
getStatePermissionRoleListDict
().
get
(
permission
),
(
'Assignor'
,
'Auditor'
))
(
'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
):
def
test_14_multiple_workflow_different_permission_roles
(
self
):
workflow1
=
self
.
createERP5Workflow
(
'edit_workflow'
,
'temporary_workflow1'
)
workflow1
=
self
.
createERP5Workflow
(
'edit_workflow'
,
'temporary_workflow1'
)
workflow2
=
self
.
createERP5Workflow
(
'edit_workflow'
,
'temporary_workflow2'
)
workflow2
=
self
.
createERP5Workflow
(
'edit_workflow'
,
'temporary_workflow2'
)
...
@@ -395,9 +395,8 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
...
@@ -395,9 +395,8 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
# create document
# create document
text_document1
=
self
.
getTestObject
()
text_document1
=
self
.
getTestObject
()
text_document1_permission
=
getattr
(
text_document1
,
permission_key
,
None
)
text_document1_permission
=
getattr
(
text_document1
,
permission_key
,
None
)
self
.
assertEqual
(
text_document1_permission
,
# self.assertEqual(getattr(text_document1, permission_key),
(
'Assignor'
,
'Assignee'
,
'Auditor'
,
'Author'
))
# ['Assignee', 'Assignor', 'Auditor', 'Author'])
# add the second workflow
# add the second workflow
text_portal_type
.
setTypeWorkflowList
([
'temporary_dc_workflow1'
,
'temporary_dc_workflow2'
])
text_portal_type
.
setTypeWorkflowList
([
'temporary_dc_workflow1'
,
'temporary_dc_workflow2'
])
...
@@ -405,9 +404,7 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
...
@@ -405,9 +404,7 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
# create document
# create document
text_document2
=
self
.
getTestObject
()
text_document2
=
self
.
getTestObject
()
text_document2_permission
=
getattr
(
text_document2
,
permission_key
,
None
)
text_document2_permission
=
getattr
(
text_document2
,
permission_key
,
None
)
self
.
assertEqual
(
text_document2_permission
,
None
)
# self.assertEqual(getattr(text_document2, permission_key),
# ['Assignee', 'Assignor', 'Auditor', 'Author'])
# migrate workflows
# migrate workflows
self
.
portal
.
portal_workflow
.
WorkflowTool_convertWorkflow
(
self
.
portal
.
portal_workflow
.
WorkflowTool_convertWorkflow
(
...
@@ -416,15 +413,21 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
...
@@ -416,15 +413,21 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
)
)
self
.
tic
()
self
.
tic
()
# create another document
# with only one workflow
text_document3
=
self
.
getTestObject
()
text_portal_type
.
setTypeWorkflowList
([
'temporary_dc_workflow1'
])
text_document3_permission
=
getattr
(
text_document3
,
permission_key
,
None
)
print
(
'text_document1_permission: %r'
%
(
text_document1_permission
,
))
# create document
print
(
'text_document2_permission: %r'
%
(
text_document2_permission
,
))
text_document1a
=
self
.
getTestObject
()
print
(
'text_document3_permission: %r'
%
(
text_document3_permission
,
))
text_document1a_permission
=
getattr
(
text_document1a
,
permission_key
,
None
)
self
.
assertEqual
(
tuple
(
getattr
(
text_document3
,
permission_key
)),
self
.
assertSameSet
(
text_document1a_permission
,
text_document1_permission
)
(
'Assignee'
,
'Assignor'
,
'Auditor'
,
'Author'
))
# 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
):
def
test_16_testWorklistViewIsAccessible
(
self
):
# check worklist view is available on workflow
# 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