Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
dcdf9533
Commit
dcdf9533
authored
Oct 30, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: test Sale Supply local roles
parent
af29eb8f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
0 deletions
+83
-0
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
...l_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
+83
-0
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
View file @
dcdf9533
...
...
@@ -1242,3 +1242,86 @@ class TestSecurePaymentTool(TestSlapOSGroupRoleSecurityMixin):
self
.
assertAcquiredPermissions
(
tool
,
[
'Add ERP5 SQL Methods'
])
class
TestSaleSupplyModule
(
TestSlapOSGroupRoleSecurityMixin
):
def
test_SaleSupplyModule
(
self
):
module
=
self
.
portal
.
sale_supply_module
# Why does the the sale_supply_module acquire the local roles
self
.
assertSecurityGroup
(
module
,
[
'F-SALE*'
,
'F-CUSTOMER'
,
module
.
Base_getOwnerId
()],
True
)
self
.
assertRoles
(
module
,
'F-SALE*'
,
[
'Auditor'
,
'Author'
])
self
.
assertRoles
(
module
,
'F-CUSTOMER'
,
[
'Auditor'
])
self
.
assertRoles
(
module
,
module
.
Base_getOwnerId
(),
[
'Owner'
])
class
TestSaleSupply
(
TestSlapOSGroupRoleSecurityMixin
):
def
test_SaleSupply_default
(
self
):
supply
=
self
.
portal
.
sale_supply_module
.
newContent
(
portal_type
=
'Sale Supply'
)
self
.
assertSecurityGroup
(
supply
,
[
'F-SALEAGT'
,
'F-SALEMAN'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
supply
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
supply
,
'F-SALEAGT'
,
[
'Assignee'
])
self
.
assertRoles
(
supply
,
'F-SALEMAN'
,
[
'Assignor'
])
def
test_SaleSupply_DestinationCustomer
(
self
):
reference
=
'TESTPERSON-%s'
%
self
.
generateNewId
()
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
reference
=
reference
)
supply
=
self
.
portal
.
sale_supply_module
.
newContent
(
portal_type
=
'Sale Supply'
)
supply
.
edit
(
destination_value
=
person
,
)
self
.
assertSecurityGroup
(
supply
,
[
'F-SALEAGT'
,
'F-SALEMAN'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
supply
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
supply
,
'F-SALEAGT'
,
[
'Assignee'
])
self
.
assertRoles
(
supply
,
'F-SALEMAN'
,
[
'Assignor'
])
supply
.
validate
()
self
.
assertSecurityGroup
(
supply
,
[
'F-SALEAGT'
,
'F-SALEMAN'
,
person
.
getUserId
(),
self
.
user_id
],
False
)
self
.
assertRoles
(
supply
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
supply
,
'F-SALEAGT'
,
[
'Assignee'
])
self
.
assertRoles
(
supply
,
'F-SALEMAN'
,
[
'Assignor'
])
self
.
assertRoles
(
supply
,
person
.
getUserId
(),
[
'Auditor'
])
supply
.
invalidate
()
self
.
assertSecurityGroup
(
supply
,
[
'F-SALEAGT'
,
'F-SALEMAN'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
supply
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
supply
,
'F-SALEAGT'
,
[
'Assignee'
])
self
.
assertRoles
(
supply
,
'F-SALEMAN'
,
[
'Assignor'
])
def
test_SaleSupply_DestinationProject
(
self
):
project
=
self
.
addProject
()
supply
=
self
.
portal
.
sale_supply_module
.
newContent
(
portal_type
=
'Sale Supply'
)
supply
.
edit
(
destination_project_value
=
project
,
)
self
.
assertSecurityGroup
(
supply
,
[
'F-SALEAGT'
,
'F-SALEMAN'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
supply
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
supply
,
'F-SALEAGT'
,
[
'Assignee'
])
self
.
assertRoles
(
supply
,
'F-SALEMAN'
,
[
'Assignor'
])
supply
.
validate
()
self
.
assertSecurityGroup
(
supply
,
[
'F-SALEAGT'
,
'F-SALEMAN'
,
project
.
getReference
(),
self
.
user_id
],
False
)
self
.
assertRoles
(
supply
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
supply
,
'F-SALEAGT'
,
[
'Assignee'
])
self
.
assertRoles
(
supply
,
'F-SALEMAN'
,
[
'Assignor'
])
self
.
assertRoles
(
supply
,
project
.
getReference
(),
[
'Auditor'
])
supply
.
invalidate
()
self
.
assertSecurityGroup
(
supply
,
[
'F-SALEAGT'
,
'F-SALEMAN'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
supply
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
supply
,
'F-SALEAGT'
,
[
'Assignee'
])
self
.
assertRoles
(
supply
,
'F-SALEMAN'
,
[
'Assignor'
])
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