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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos.core
Commits
af46e85d
Commit
af46e85d
authored
Nov 07, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test up to Slave Instance.
parent
98d02378
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
5 deletions
+82
-5
master/bt5/slapos_erp5/TestTemplateItem/testSlapOSGroupRoleSecurity.py
...apos_erp5/TestTemplateItem/testSlapOSGroupRoleSecurity.py
+81
-4
master/bt5/slapos_erp5/bt/revision
master/bt5/slapos_erp5/bt/revision
+1
-1
No files found.
master/bt5/slapos_erp5/TestTemplateItem/testSlapOSGroupRoleSecurity.py
View file @
af46e85d
...
...
@@ -454,12 +454,89 @@ class TestPersonModule(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
module
,
'zope'
,
[
'Owner'
])
class
TestPresentation
(
TestSlapOSGroupRoleSecurityMixin
):
def
test
(
self
):
raise
NotImplementedError
def
test_SecurityForShacache
(
self
):
presentation
=
self
.
portal
.
document_module
.
newContent
(
portal_type
=
'Presentation'
)
presentation
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
presentation
,
[
'G-COMPANY'
,
self
.
user_id
,
'R-COMPUTER'
,
'R-INSTANCE'
,
'R-MEMBER'
],
False
)
self
.
assertRoles
(
presentation
,
'R-COMPUTER'
,
[
'Auditor'
])
self
.
assertRoles
(
presentation
,
'R-INSTANCE'
,
[
'Auditor'
])
self
.
assertRoles
(
presentation
,
'R-MEMBER'
,
[
'Auditor'
])
self
.
assertRoles
(
presentation
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
presentation
,
self
.
user_id
,
[
'Owner'
])
test_GroupCompany
=
test_SecurityForShacache
class
TestSlaveInstance
(
TestSlapOSGroupRoleSecurityMixin
):
def
test
(
self
):
raise
NotImplementedError
def
test_GroupCompany
(
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
.
assertRoles
(
instance
,
self
.
user_id
,
[
'Owner'
,
'Assignee'
])
test_OwnerBecomeAssignee
=
test_GroupCompany
def
test_CustomerOfTheInstance
(
self
):
customer_reference
=
'TESTPERSON-%s'
%
self
.
generateNewId
()
customer
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
reference
=
customer_reference
)
subscription_reference
=
'TESTHS-%s '
%
self
.
generateNewId
()
subscription
=
self
.
portal
.
hosting_subscription_module
.
newContent
(
portal_type
=
'Hosting Subscription'
,
reference
=
subscription_reference
,
destination_section
=
customer
.
getRelativeUrl
())
instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Slave Instance'
,
specialise
=
subscription
.
getRelativeUrl
())
instance
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
instance
,
[
'G-COMPANY'
,
customer_reference
,
subscription_reference
,
self
.
user_id
],
False
)
self
.
assertRoles
(
instance
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
instance
,
customer_reference
,
[
'Assignee'
])
self
.
assertRoles
(
instance
,
subscription_reference
,
[
'Assignor'
])
self
.
assertRoles
(
instance
,
self
.
user_id
,
[
'Owner'
,
'Assignee'
])
test_InstanceRelatedByHostingSubscription
=
test_CustomerOfTheInstance
def
test_SoftwareInstanceWhichProvidesThisSlaveInstance
(
self
):
computer_reference
=
'TESTCOMP-%s'
%
self
.
generateNewId
()
computer
=
self
.
portal
.
computer_module
.
template_computer
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
computer
.
edit
(
reference
=
computer_reference
)
partition
=
computer
.
newContent
(
portal_type
=
'Computer Partition'
)
provider_reference
=
'TESTSI-%s'
%
self
.
generateNewId
()
provider
=
self
.
portal
.
software_instance_module
\
.
template_software_instance
.
Base_createCloneDocument
(
batch_mode
=
1
)
provider
.
edit
(
reference
=
provider_reference
,
aggregate
=
partition
.
getRelativeUrl
())
provider
.
validate
()
provider
.
recursiveImmediateReindexObject
()
partition
.
recursiveImmediateReindexObject
()
instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Slave Instance'
,
aggregate
=
partition
.
getRelativeUrl
())
instance
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
instance
,
[
'G-COMPANY'
,
provider_reference
,
computer_reference
,
self
.
user_id
],
False
)
self
.
assertRoles
(
instance
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
instance
,
provider_reference
,
[
'Assignor'
])
self
.
assertRoles
(
instance
,
computer_reference
,
[
'Assignor'
])
self
.
assertRoles
(
instance
,
self
.
user_id
,
[
'Owner'
,
'Assignee'
])
test_Computer
=
test_SoftwareInstanceWhichProvidesThisSlaveInstance
class
TestSoftwareInstallation
(
TestSlapOSGroupRoleSecurityMixin
):
def
test
(
self
):
...
...
master/bt5/slapos_erp5/bt/revision
View file @
af46e85d
55
\ No newline at end of file
56
\ No newline at end of file
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