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
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
Titouan Soulard
slapos.core
Commits
0b15e24f
Commit
0b15e24f
authored
Jan 13, 2023
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: test Slave Instance local roles
parent
3f662441
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
64 deletions
+14
-64
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
...l_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
+14
-64
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
View file @
0b15e24f
...
...
@@ -741,13 +741,12 @@ class TestPersonModule(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
module
,
self
.
user_id
,
[
'Owner'
])
class
TestSlaveInstance
(
TestSlapOSGroupRoleSecurityMixin
):
def
test_
GroupCompany
(
self
):
def
test_
default
(
self
):
instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Slave Instance'
)
instance
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
instance
,
[
'G-COMPANY'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
instance
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertSecurityGroup
(
instance
,
[
self
.
user_id
],
False
)
self
.
assertRoles
(
instance
,
self
.
user_id
,
[
'Owner'
])
def
test_CustomerOfTheInstance
(
self
):
...
...
@@ -765,76 +764,28 @@ class TestSlaveInstance(TestSlapOSGroupRoleSecurityMixin):
portal_type
=
'Slave Instance'
,
specialise
=
subscription
.
getRelativeUrl
())
instance
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
instance
,
[
'G-COMPANY'
,
customer
.
getUserId
(),
self
.
assertSecurityGroup
(
instance
,
[
customer
.
getUserId
(),
subscription_reference
,
self
.
user_id
],
False
)
self
.
assertRoles
(
instance
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
instance
,
customer
.
getUserId
(),
[
'Assignee'
])
self
.
assertRoles
(
instance
,
subscription_reference
,
[
'Assignee'
])
self
.
assertRoles
(
instance
,
self
.
user_id
,
[
'Owner'
])
def
test_ProjectMember
(
self
):
project
=
self
.
addProject
()
customer
=
self
.
makePerson
(
project
,
user
=
1
)
subscription_reference
=
'TESTHS-%s '
%
self
.
generateNewId
()
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
title
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
reference
=
subscription_reference
,
destination_section
=
customer
.
getRelativeUrl
())
project
=
self
.
portal
.
project_module
.
newContent
(
portal_type
=
'Project'
)
self
.
tic
()
self
.
login
(
customer
.
getUserId
())
instance_tree
.
InstanceTree_createMovement
(
destination_project
=
project
.
getRelativeUrl
())
self
.
login
()
self
.
tic
()
instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Slave Instance'
,
specialise
=
instance_tree
.
getRelativeUrl
())
instance
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
instance
,
[
'G-COMPANY'
,
customer
.
getUserId
(),
subscription_reference
,
self
.
user_id
,
project
.
getReference
()],
False
)
self
.
assertRoles
(
instance
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
instance
,
customer
.
getUserId
(),
[
'Assignee'
])
self
.
assertRoles
(
instance
,
subscription_reference
,
[
'Assignee'
])
self
.
assertRoles
(
instance
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
instance
,
project
.
getReference
(),
[
'Assignee'
])
def
test_OrganisationMember
(
self
):
project
=
self
.
addProject
()
customer
=
self
.
makePerson
(
project
,
user
=
1
)
subscription_reference
=
'TESTHS-%s '
%
self
.
generateNewId
()
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
title
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
reference
=
subscription_reference
,
destination_section
=
customer
.
getRelativeUrl
())
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
,
reference
=
"TESTO-%s"
%
self
.
generateNewId
())
self
.
tic
()
self
.
login
(
customer
.
getUserId
())
instance_tree
.
InstanceTree_createMovement
(
destination
=
organisation
.
getRelativeUrl
())
self
.
login
()
self
.
tic
()
instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Slave Instance'
,
specialise
=
instance_tree
.
getRelativeUrl
())
portal_type
=
'Slave Instance'
,
follow_up_value
=
project
)
instance
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
instance
,
[
'G-COMPANY'
,
customer
.
getUserId
(),
subscription_reference
,
self
.
user_id
,
organisation
.
getReference
()],
False
)
self
.
assertRoles
(
instance
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
instance
,
customer
.
getUserId
(),
[
'Assignee'
]
)
self
.
assertRoles
(
instance
,
subscription_reference
,
[
'Assignee'
]
)
self
.
assertSecurityGroup
(
instance
,
[
self
.
user_id
,
'%s_F-PRODAGNT'
%
project
.
getReference
(),
'%s_F-PRODMAN'
%
project
.
getReference
(
)
],
False
)
self
.
assertRoles
(
instance
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
instance
,
organisation
.
getReference
(),
[
'Assignee'
])
self
.
assertRoles
(
instance
,
'%s_F-PRODAGNT'
%
project
.
getReference
(),
[
'Assignee'
])
self
.
assertRoles
(
instance
,
'%s_F-PRODMAN'
%
project
.
getReference
(),
[
'Assignor'
])
def
test_SoftwareInstanceWhichProvidesThisSlaveInstance
(
self
):
compute_node_reference
=
'TESTCOMP-%s'
%
self
.
generateNewId
()
...
...
@@ -857,9 +808,8 @@ class TestSlaveInstance(TestSlapOSGroupRoleSecurityMixin):
instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Slave Instance'
,
aggregate
=
partition
.
getRelativeUrl
())
instance
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
instance
,
[
'G-COMPANY'
,
provider
.
getUserId
(),
self
.
assertSecurityGroup
(
instance
,
[
provider
.
getUserId
(),
compute_node
.
getUserId
(),
self
.
user_id
],
False
)
self
.
assertRoles
(
instance
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
instance
,
provider
.
getUserId
(),
[
'Assignor'
])
self
.
assertRoles
(
instance
,
compute_node
.
getUserId
(),
[
'Assignor'
])
self
.
assertRoles
(
instance
,
self
.
user_id
,
[
'Owner'
])
...
...
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