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
Carlos Ramos Carreño
erp5
Commits
ef1cf2b3
Commit
ef1cf2b3
authored
Oct 22, 2022
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_core_test: fix typos.
parent
61aa34c1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
+22
-22
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBase.py
.../TestTemplateItem/portal_components/test.erp5.testBase.py
+22
-22
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBase.py
View file @
ef1cf2b3
...
...
@@ -966,19 +966,19 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
# Add a non-existent workflow.
pw
=
self
.
getWorkflowTool
()
dummy_simulation_wor
l
flow_id
=
'fake_simulation_workflow'
dummy_validation_wor
l
flow_id
=
'fake_validation_workflow'
dummy_simulation_wor
k
flow_id
=
'fake_simulation_workflow'
dummy_validation_wor
k
flow_id
=
'fake_validation_workflow'
#Assume that erp5_styles workflow Manage permissions with acquired Role by default
addWorkflowByType
(
pw
,
'erp5_workflow'
,
dummy_simulation_wor
l
flow_id
)
addWorkflowByType
(
pw
,
'erp5_workflow'
,
dummy_validation_wor
l
flow_id
)
dummy_simulation_wor
lflow
=
pw
[
dummy_simulation_worl
flow_id
]
dummy_validation_wor
lflow
=
pw
[
dummy_validation_worl
flow_id
]
dummy_validation_wor
l
flow
.
variables
.
setStateVar
(
'validation_state'
)
addWorkflowByType
(
pw
,
'erp5_workflow'
,
dummy_simulation_wor
k
flow_id
)
addWorkflowByType
(
pw
,
'erp5_workflow'
,
dummy_validation_wor
k
flow_id
)
dummy_simulation_wor
kflow
=
pw
[
dummy_simulation_work
flow_id
]
dummy_validation_wor
kflow
=
pw
[
dummy_validation_work
flow_id
]
dummy_validation_wor
k
flow
.
variables
.
setStateVar
(
'validation_state'
)
organisation_type
=
portal
.
portal_types
.
getTypeInfo
(
portal_type
)
organisation_initial_workflow_list
=
organisation_type
.
getTypeWorkflowList
()
organisation_type
.
setTypeWorkflowList
([
dummy_validation_wor
l
flow_id
,
dummy_simulation_wor
l
flow_id
])
permission_list
=
list
(
dummy_simulation_wor
l
flow
.
permissions
)
organisation_type
.
setTypeWorkflowList
([
dummy_validation_wor
k
flow_id
,
dummy_simulation_wor
k
flow_id
])
permission_list
=
list
(
dummy_simulation_wor
k
flow
.
permissions
)
manager_has_permission
=
{}
for
permission
in
permission_list
:
manager_has_permission
[
permission
]
=
(
'Manager'
,)
...
...
@@ -989,7 +989,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
user
=
getSecurityManager
().
getUser
()
try
:
self
.
assertTrue
(
permission_list
)
self
.
assertFalse
(
dummy_simulation_wor
l
flow
.
states
.
draft
.
permission_roles
)
self
.
assertFalse
(
dummy_simulation_wor
k
flow
.
states
.
draft
.
permission_roles
)
#1
obj
=
module
.
newContent
(
portal_type
=
portal_type
)
#No role is defined by default on workflow
...
...
@@ -999,28 +999,28 @@ 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_wor
l
flow
.
states
.
draft
.
permission_roles
=
manager_has_permission
.
copy
()
dummy_validation_wor
l
flow
.
states
.
draft
.
permission_roles
=
manager_has_permission
.
copy
()
dummy_simulation_wor
l
flow
.
updateRoleMappingsFor
(
obj
)
dummy_validation_wor
l
flow
.
updateRoleMappingsFor
(
obj
)
dummy_simulation_wor
k
flow
.
states
.
draft
.
permission_roles
=
manager_has_permission
.
copy
()
dummy_validation_wor
k
flow
.
states
.
draft
.
permission_roles
=
manager_has_permission
.
copy
()
dummy_simulation_wor
k
flow
.
updateRoleMappingsFor
(
obj
)
dummy_validation_wor
k
flow
.
updateRoleMappingsFor
(
obj
)
for
permission
in
permission_list
:
self
.
assertTrue
(
user
.
has_permission
(
permission
,
obj
))
#3 change only dummy_simulation_wor
l
flow
dummy_simulation_wor
l
flow
.
states
.
draft
.
permission_roles
=
manager_has_no_permission
.
copy
()
dummy_simulation_wor
l
flow
.
updateRoleMappingsFor
(
obj
)
#3 change only dummy_simulation_wor
k
flow
dummy_simulation_wor
k
flow
.
states
.
draft
.
permission_roles
=
manager_has_no_permission
.
copy
()
dummy_simulation_wor
k
flow
.
updateRoleMappingsFor
(
obj
)
for
permission
in
permission_list
:
self
.
assertFalse
(
user
.
has_permission
(
permission
,
obj
))
#4 enable acquisition for dummy_simulation_wor
l
flow
dummy_simulation_wor
l
flow
.
states
.
draft
.
permission_roles
=
None
dummy_simulation_wor
l
flow
.
updateRoleMappingsFor
(
obj
)
#4 enable acquisition for dummy_simulation_wor
k
flow
dummy_simulation_wor
k
flow
.
states
.
draft
.
permission_roles
=
None
dummy_simulation_wor
k
flow
.
updateRoleMappingsFor
(
obj
)
for
permission
in
permission_list
:
self
.
assertTrue
(
user
.
has_permission
(
permission
,
obj
))
finally
:
# Make sure that the artificial workflow is not referred to any longer.
organisation_type
.
setTypeWorkflowList
(
organisation_initial_workflow_list
)
pw
.
manage_delObjects
([
dummy_simulation_wor
lflow_id
,
dummy_validation_worl
flow_id
])
pw
.
manage_delObjects
([
dummy_simulation_wor
kflow_id
,
dummy_validation_work
flow_id
])
def
test_getViewPermissionOwnerDefault
(
self
):
"""Test getViewPermissionOwner method behaviour"""
...
...
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