Commit 3905a253 authored by Łukasz Nowak's avatar Łukasz Nowak

Test role generation up to Computer Partition.

parent 76581c90
master alain-message amarisoft boot/offline cliff-cleanup console cygwin-link-local feat/node-secrets feat/nxdbom feat/openapi feat/slapos-computer-partitions-capabilities-wip feat/standalone-service feat_open_order feature/cgroups feature/format-crumbled feature/lsb_release_sle15 feature/manager-cpuset feature/python-pip-sle15.6 feature/software_url_as_path feature/software_url_as_path_old fix/manager_interface fix/slapos-ansible fix/suse-detection fix/verify fixuitestfrontpage for_testrunner_1 hosting_daily_invoice json-api json-api-2022 json-api-slapgrid master-dev message-box proxy schema slapos-override-env slapproxy-connection-parameter testing/branch1 update_cachecontrol_dependency 1.11.0 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.3 1.9.2 1.9.1 1.9.0 1.8.6 1.8.5 1.8.4 1.8.3 1.8.2 1.8.1 1.8.0 1.7.13 1.7.12 1.7.11 1.7.10 1.7.9 1.7.8 1.7.7 1.7.6 1.7.5 1.7.4 1.7.3 1.7.2 1.7.1 1.7.0 1.6.19 1.6.18 1.6.17 1.6.16 1.6.15 1.6.14 1.6.13 1.6.12 1.6.11 1.6.10 1.6.9 1.6.8 1.6.7 1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.12 1.5.11 1.5.10 1.5.9 1.5.8 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 1.4.28 1.4.27 1.4.26 1.4.25 1.4.24 1.4.23 1.4.22 1.4.21 1.4.20 1.4.19 1.4.17 1.4.16 1.4.15 1.4.14 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.18 1.3.17 1.3.16 1.3.15 1.3.14 1.3.13 1.3.12 1.3.11 1.3.10 1.3.9 1.3.8 1.3.7 1.3.6.3 1.3.6.2 1.3.6.1 1.3.6 1.3.5 1.3.4 1.3.3 1.3.2 1.3.1 1.3.0 1.2.4.1 1.2.4 1.2.3.1 1.2.3 1.2.2 1.2.1 1.2.0 1.1.3 1.1.2 1.1.1 1.1.0 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 1.0.0 1.0.0rc6 1.0.0rc5 1.0.0rc4 1.0.0rc3 1.0.0-rc1 0.35.1 0.34 v1.8.1 master-20240326 master-20180917
No related merge requests found
...@@ -114,3 +114,120 @@ class TestComputer(TestSlapOSGroupRoleSecurityMixin): ...@@ -114,3 +114,120 @@ class TestComputer(TestSlapOSGroupRoleSecurityMixin):
[self.user_id, 'G-COMPANY', reference], False) [self.user_id, 'G-COMPANY', reference], False)
self.assertRoles(computer, reference, ['Assignor']) self.assertRoles(computer, reference, ['Assignor'])
class TestComputerModel(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self):
model = self.portal.computer_model_module.newContent(
portal_type='Computer Model')
model.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(model,
['G-COMPANY', self.user_id], False)
self.assertRoles(model, 'G-COMPANY', ['Assignor'])
def test_ComputerAgent(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
model = self.portal.computer_model_module.newContent(
portal_type='Computer Model',
source_administration=person.getRelativeUrl())
model.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(model,
['G-COMPANY', self.user_id, reference], False)
self.assertRoles(model, reference, ['Assignee'])
class TestComputerModelModule(TestSlapOSGroupRoleSecurityMixin):
def test(self):
module = self.portal.computer_model_module
self.assertSecurityGroup(module,
['R-MEMBER', 'zope'], False)
self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author'])
class TestComputerModule(TestSlapOSGroupRoleSecurityMixin):
def test(self):
module = self.portal.computer_module
self.assertSecurityGroup(module,
['R-COMPUTER', 'R-MEMBER', 'R-SHADOW-PERSON', 'zope'], False)
self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author'])
self.assertRoles(module, 'R-COMPUTER', ['Auditor'])
self.assertRoles(module, 'R-SHADOW-PERSON', ['Auditor'])
class TestComputerNetwork(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self):
network = self.portal.computer_network_module.newContent(
portal_type='Computer Network')
network.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(network,
['G-COMPANY', 'R-SHADOW-PERSON', self.user_id], False)
self.assertRoles(network, 'G-COMPANY', ['Assignor'])
self.assertRoles(network, 'R-SHADOW-PERSON', ['Auditor'])
test_PersonShadow = test_GroupCompany
def test_ComputerAgent(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
network = self.portal.computer_network_module.newContent(
portal_type='Computer Network',
source_administration=person.getRelativeUrl())
network.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(network,
['G-COMPANY', 'R-SHADOW-PERSON', self.user_id, reference], False)
self.assertRoles(network, reference, ['Assignee'])
class TestComputerNetworkModule(TestSlapOSGroupRoleSecurityMixin):
def test(self):
module = self.portal.computer_network_module
self.assertSecurityGroup(module,
['R-MEMBER', 'R-SHADOW-PERSON', 'zope'], False)
self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author'])
self.assertRoles(module, 'R-SHADOW-PERSON', ['Auditor'])
class TestComputerPartition(TestSlapOSGroupRoleSecurityMixin):
def test_CustomerOfThePartition(self):
partition = self.portal.computer_module.newContent(
portal_type='Computer').newContent(portal_type='Computer Partition')
self.portal.portal_workflow._jumpToStateFor(partition, 'busy')
partition.recursiveImmediateReindexObject()
instance_customer_reference = 'TESTPERSON-%s' % self.generateNewId()
slave_customer_reference = 'TESTPERSON-%s' % self.generateNewId()
instance_customer = self.portal.person_module.newContent(
portal_type='Person', reference=instance_customer_reference)
slave_customer = self.portal.person_module.newContent(
portal_type='Person', reference=slave_customer_reference)
instance_subscription_reference = 'TESTHS-%s' % self.generateNewId()
instance_subscription = self.portal.hosting_subscription_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
instance_subscription.edit(
destination_section=instance_customer.getRelativeUrl(),
reference=instance_subscription_reference)
instance = self.portal.software_instance_module.template_software_instance\
.Base_createCloneDocument(batch_mode=1)
instance.edit(specialise=instance_subscription.getRelativeUrl(),
aggregate=partition.getRelativeUrl())
instance.validate()
instance.recursiveImmediateReindexObject()
slave_subscription = self.portal.hosting_subscription_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
slave_subscription.edit(
destination_section=slave_customer.getRelativeUrl())
slave = self.portal.software_instance_module.template_slave_instance\
.Base_createCloneDocument(batch_mode=1)
slave.validate()
slave.edit(specialise=slave_subscription.getRelativeUrl(),
aggregate=partition.getRelativeUrl())
slave.recursiveImmediateReindexObject()
partition.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(partition,
[self.user_id, instance_customer_reference, slave_customer_reference,
instance_subscription_reference], True)
self.assertRoles(partition, instance_customer_reference, ['Auditor'])
self.assertRoles(partition, slave_customer_reference, ['Auditor'])
self.assertRoles(partition, instance_subscription_reference, ['Auditor'])
test_SoftwareInstanceGroupRelatedToComputerPartition = \
test_CustomerOfThePartition
38 39
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment