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
Levin Zimmermann
erp5
Commits
6f6af0c5
Commit
6f6af0c5
authored
Oct 22, 2022
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: rewrite erp5_core_test with EPR5 Workflow.
parent
ef1cf2b3
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
188 additions
and
166 deletions
+188
-166
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBase.py
.../TestTemplateItem/portal_components/test.erp5.testBase.py
+15
-11
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
...eItem/portal_components/test.erp5.testBusinessTemplate.py
+10
-5
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testInteractionWorkflow.py
...em/portal_components/test.erp5.testInteractionWorkflow.py
+163
-150
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBase.py
View file @
6f6af0c5
...
...
@@ -969,16 +969,20 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
dummy_simulation_workflow_id
=
'fake_simulation_workflow'
dummy_validation_workflow_id
=
'fake_validation_workflow'
#Assume that erp5_styles workflow Manage permissions with acquired Role by default
addWorkflowByType
(
pw
,
'erp5_workflow'
,
dummy_simulation_workflow_id
)
addWorkflowByType
(
pw
,
'erp5_workflow'
,
dummy_validation_workflow_id
)
dummy_simulation_workflow
=
pw
[
dummy_simulation_workflow_id
]
dummy_validation_workflow
=
pw
[
dummy_validation_workflow_id
]
dummy_validation_workflow
.
variables
.
setStateVar
(
'validation_state'
)
dummy_simulation_workflow
=
pw
.
newContent
(
portal_type
=
'Workflow'
,
reference
=
dummy_simulation_workflow_id
,
)
dummy_validation_workflow
=
pw
.
newContent
(
portal_type
=
'Workflow'
,
reference
=
dummy_validation_workflow_id
,
state_variable
=
'validation_state'
,
)
organisation_type
=
portal
.
portal_types
.
getTypeInfo
(
portal_type
)
organisation_initial_workflow_list
=
organisation_type
.
getTypeWorkflowList
()
organisation_type
.
setTypeWorkflowList
([
dummy_validation_workflow_id
,
dummy_simulation_workflow_id
])
permission_list
=
list
(
dummy_simulation_workflow
.
permissions
)
permission_list
=
dummy_simulation_workflow
.
getWorkflowManagedPermissionList
(
)
manager_has_permission
=
{}
for
permission
in
permission_list
:
manager_has_permission
[
permission
]
=
(
'Manager'
,)
...
...
@@ -989,7 +993,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
user
=
getSecurityManager
().
getUser
()
try
:
self
.
assertTrue
(
permission_list
)
self
.
assertFalse
(
dummy_simulation_workflow
.
states
.
draft
.
permission_roles
)
self
.
assertFalse
(
dummy_simulation_workflow
[
'state_draft'
].
getStatePermissionRoleListDict
()
)
#1
obj
=
module
.
newContent
(
portal_type
=
portal_type
)
#No role is defined by default on workflow
...
...
@@ -999,21 +1003,21 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
for
permission
in
permission_list
:
self
.
assertTrue
(
user
.
has_permission
(
permission
,
obj
))
#2 Now configure both workflow with same configuration
dummy_simulation_workflow
.
states
.
draft
.
permission_roles
=
manager_has_permission
.
copy
(
)
dummy_validation_workflow
.
states
.
draft
.
permission_roles
=
manager_has_permission
.
copy
(
)
dummy_simulation_workflow
[
'state_draft'
].
setStatePermissionRoleListDict
(
manager_has_permission
.
copy
()
)
dummy_validation_workflow
[
'state_draft'
].
setStatePermissionRoleListDict
(
manager_has_permission
.
copy
()
)
dummy_simulation_workflow
.
updateRoleMappingsFor
(
obj
)
dummy_validation_workflow
.
updateRoleMappingsFor
(
obj
)
for
permission
in
permission_list
:
self
.
assertTrue
(
user
.
has_permission
(
permission
,
obj
))
#3 change only dummy_simulation_workflow
dummy_simulation_workflow
.
states
.
draft
.
permission_roles
=
manager_has_no_permission
.
copy
(
)
dummy_simulation_workflow
[
'state_draft'
].
setStatePermissionRoleListDict
(
manager_has_no_permission
.
copy
()
)
dummy_simulation_workflow
.
updateRoleMappingsFor
(
obj
)
for
permission
in
permission_list
:
self
.
assertFalse
(
user
.
has_permission
(
permission
,
obj
))
#4 enable acquisition for dummy_simulation_workflow
dummy_simulation_workflow
.
states
.
draft
.
permission_roles
=
None
dummy_simulation_workflow
[
'state_draft'
].
setAcquirePermissionList
(
permission_list
)
dummy_simulation_workflow
.
updateRoleMappingsFor
(
obj
)
for
permission
in
permission_list
:
self
.
assertTrue
(
user
.
has_permission
(
permission
,
obj
))
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
View file @
6f6af0c5
...
...
@@ -39,7 +39,6 @@ from urllib import pathname2url
from
Products.ERP5Type.Globals
import
PersistentMapping
from
Products.ERP5Type.dynamic.lazy_class
import
ERP5BaseBroken
from
Products.ERP5Type.tests.utils
import
LogInterceptor
from
Products.ERP5Type.Workflow
import
addWorkflowByType
import
shutil
import
os
import
random
...
...
@@ -1315,8 +1314,11 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""
wf_id
=
'geek_workflow'
pw
=
self
.
getWorkflowTool
()
addWorkflowByType
(
pw
,
WORKFLOW_TYPE
,
wf_id
)
workflow
=
pw
.
_getOb
(
wf_id
,
None
)
workflow
=
pw
.
newContent
(
portal_type
=
'Workflow'
,
reference
=
wf_id
,
)
self
.
tic
()
self
.
assertTrue
(
workflow
is
not
None
)
sequence
.
edit
(
workflow_id
=
workflow
.
getId
())
...
...
@@ -2886,8 +2888,11 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""
wf_id
=
'custom_geek_workflow'
pw
=
self
.
getWorkflowTool
()
addWorkflowByType
(
pw
,
WORKFLOW_TYPE
,
wf_id
)
workflow
=
pw
.
_getOb
(
wf_id
,
None
)
workflow
=
pw
.
newContent
(
portal_type
=
'Workflow'
,
reference
=
wf_id
,
)
self
.
tic
()
self
.
assertTrue
(
workflow
is
not
None
)
sequence
.
edit
(
workflow_id
=
workflow
.
getId
())
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testInteractionWorkflow.py
View file @
6f6af0c5
This diff is collapsed.
Click to expand it.
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