Commit 6d709dce authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: Clean up and extra test for Organisation

   Remove useless duplication on the security test (just duplication)
   Remove and include test for Organisation
parent 40e29fa4
Pipeline #12812 failed with stage
in 0 seconds
...@@ -232,7 +232,6 @@ class TestComputerNetwork(TestSlapOSGroupRoleSecurityMixin): ...@@ -232,7 +232,6 @@ class TestComputerNetwork(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(network, 'R-SHADOW-PERSON', ['Auditor']) self.assertRoles(network, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(network, self.user_id, ['Assignee', 'Owner']) self.assertRoles(network, self.user_id, ['Assignee', 'Owner'])
test_PersonShadow = test_GroupCompany
def test_ComputerAgent(self): def test_ComputerAgent(self):
reference = 'TESTPERSON-%s' % self.generateNewId() reference = 'TESTPERSON-%s' % self.generateNewId()
...@@ -454,7 +453,7 @@ class TestImageModule(TestSlapOSGroupRoleSecurityMixin): ...@@ -454,7 +453,7 @@ class TestImageModule(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(module, self.user_id, ['Owner']) self.assertRoles(module, self.user_id, ['Owner'])
class TestOrganisation(TestSlapOSGroupRoleSecurityMixin): class TestOrganisation(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self): def test(self):
organisation = self.portal.organisation_module.newContent( organisation = self.portal.organisation_module.newContent(
portal_type='Organisation') portal_type='Organisation')
organisation.setReference("TESTORG-%s" % self.generateNewId()) organisation.setReference("TESTORG-%s" % self.generateNewId())
...@@ -466,7 +465,19 @@ class TestOrganisation(TestSlapOSGroupRoleSecurityMixin): ...@@ -466,7 +465,19 @@ class TestOrganisation(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(organisation, 'R-SHADOW-PERSON', ['Auditor']) self.assertRoles(organisation, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(organisation, self.user_id, ['Owner', 'Assignee']) self.assertRoles(organisation, self.user_id, ['Owner', 'Assignee'])
test_Member = test_GroupCompany def test_GroupCompany(self):
organisation = self.portal.organisation_module.newContent(
portal_type='Organisation')
organisation.setReference("TESTORG-%s" % self.generateNewId())
organisation.setGroup("company")
organisation.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(organisation,
['G-COMPANY', self.user_id, organisation.getReference(), 'R-SHADOW-PERSON', 'R-MEMBER'], False)
self.assertRoles(organisation, 'G-COMPANY', ['Assignor'])
self.assertRoles(organisation, organisation.getReference(), ['Assignee'])
self.assertRoles(organisation, 'R-MEMBER', ['Auditor'])
self.assertRoles(organisation, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(organisation, self.user_id, ['Owner', 'Assignee'])
class TestOrganisationModule(TestSlapOSGroupRoleSecurityMixin): class TestOrganisationModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
...@@ -649,8 +660,6 @@ class TestSlaveInstance(TestSlapOSGroupRoleSecurityMixin): ...@@ -649,8 +660,6 @@ class TestSlaveInstance(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(instance, 'G-COMPANY', ['Assignor']) self.assertRoles(instance, 'G-COMPANY', ['Assignor'])
self.assertRoles(instance, self.user_id, ['Owner']) self.assertRoles(instance, self.user_id, ['Owner'])
test_OwnerBecomeAssignee = test_GroupCompany
def test_CustomerOfTheInstance(self): def test_CustomerOfTheInstance(self):
customer_reference = 'TESTPERSON-%s' % self.generateNewId() customer_reference = 'TESTPERSON-%s' % self.generateNewId()
customer = self.portal.person_module.newContent( customer = self.portal.person_module.newContent(
...@@ -673,8 +682,6 @@ class TestSlaveInstance(TestSlapOSGroupRoleSecurityMixin): ...@@ -673,8 +682,6 @@ class TestSlaveInstance(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(instance, subscription_reference, ['Assignee']) self.assertRoles(instance, subscription_reference, ['Assignee'])
self.assertRoles(instance, self.user_id, ['Owner']) self.assertRoles(instance, self.user_id, ['Owner'])
test_InstanceRelatedByHostingSubscription = test_CustomerOfTheInstance
def test_SoftwareInstanceWhichProvidesThisSlaveInstance(self): def test_SoftwareInstanceWhichProvidesThisSlaveInstance(self):
computer_reference = 'TESTCOMP-%s' % self.generateNewId() computer_reference = 'TESTCOMP-%s' % self.generateNewId()
computer = self.portal.computer_module.template_computer\ computer = self.portal.computer_module.template_computer\
...@@ -703,8 +710,6 @@ class TestSlaveInstance(TestSlapOSGroupRoleSecurityMixin): ...@@ -703,8 +710,6 @@ class TestSlaveInstance(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(instance, computer.getUserId(), ['Assignor']) self.assertRoles(instance, computer.getUserId(), ['Assignor'])
self.assertRoles(instance, self.user_id, ['Owner']) self.assertRoles(instance, self.user_id, ['Owner'])
test_Computer = test_SoftwareInstanceWhichProvidesThisSlaveInstance
class TestSoftwareInstallation(TestSlapOSGroupRoleSecurityMixin): class TestSoftwareInstallation(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self): def test_GroupCompany(self):
installation = self.portal.software_installation_module.newContent( installation = self.portal.software_installation_module.newContent(
...@@ -716,8 +721,6 @@ class TestSoftwareInstallation(TestSlapOSGroupRoleSecurityMixin): ...@@ -716,8 +721,6 @@ class TestSoftwareInstallation(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(installation, 'G-COMPANY', ['Assignor']) self.assertRoles(installation, 'G-COMPANY', ['Assignor'])
self.assertRoles(installation, self.user_id, ['Owner']) self.assertRoles(installation, self.user_id, ['Owner'])
test_OwnerBecomeAssignee = test_GroupCompany
def test_Computer(self): def test_Computer(self):
computer_reference = 'TESTCOMP-%s' % self.generateNewId() computer_reference = 'TESTCOMP-%s' % self.generateNewId()
computer = self.portal.computer_module.template_computer\ computer = self.portal.computer_module.template_computer\
...@@ -772,8 +775,6 @@ class TestSoftwareInstance(TestSlapOSGroupRoleSecurityMixin): ...@@ -772,8 +775,6 @@ class TestSoftwareInstance(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(instance, 'G-COMPANY', ['Assignor']) self.assertRoles(instance, 'G-COMPANY', ['Assignor'])
self.assertRoles(instance, self.user_id, ['Owner']) self.assertRoles(instance, self.user_id, ['Owner'])
test_OwnerBecomeAssignee = test_GroupCompany
def test_CustomerOfTheInstance(self): def test_CustomerOfTheInstance(self):
customer_reference = 'TESTPERSON-%s' % self.generateNewId() customer_reference = 'TESTPERSON-%s' % self.generateNewId()
customer = self.portal.person_module.newContent( customer = self.portal.person_module.newContent(
...@@ -796,8 +797,6 @@ class TestSoftwareInstance(TestSlapOSGroupRoleSecurityMixin): ...@@ -796,8 +797,6 @@ class TestSoftwareInstance(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(instance, subscription_reference, ['Assignee']) self.assertRoles(instance, subscription_reference, ['Assignee'])
self.assertRoles(instance, self.user_id, ['Owner']) self.assertRoles(instance, self.user_id, ['Owner'])
test_InstanceRelatedByHostingSubscription = test_CustomerOfTheInstance
def test_Computer(self): def test_Computer(self):
computer_reference = 'TESTCOMP-%s' % self.generateNewId() computer_reference = 'TESTCOMP-%s' % self.generateNewId()
computer = self.portal.computer_module.template_computer\ computer = self.portal.computer_module.template_computer\
...@@ -840,8 +839,6 @@ class TestSoftwareProduct(TestSlapOSGroupRoleSecurityMixin): ...@@ -840,8 +839,6 @@ class TestSoftwareProduct(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(product, 'R-MEMBER', ['Auditor']) self.assertRoles(product, 'R-MEMBER', ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner']) self.assertRoles(product, self.user_id, ['Owner'])
test_Member = test_GroupCompany
class TestSoftwareProductModule(TestSlapOSGroupRoleSecurityMixin): class TestSoftwareProductModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.software_product_module module = self.portal.software_product_module
...@@ -863,8 +860,6 @@ class TestSoftwareRelease(TestSlapOSGroupRoleSecurityMixin): ...@@ -863,8 +860,6 @@ class TestSoftwareRelease(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(release, 'R-MEMBER', ['Auditor']) self.assertRoles(release, 'R-MEMBER', ['Auditor'])
self.assertRoles(release, self.user_id, ['Owner']) self.assertRoles(release, self.user_id, ['Owner'])
test_Member = test_GroupCompany
class TestSoftwareReleaseModule(TestSlapOSGroupRoleSecurityMixin): class TestSoftwareReleaseModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.software_release_module module = self.portal.software_release_module
......
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