Commit 7b937c3f authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: Change ownership modules on testSlapOSERP5GroupRoleSecurityChange

A common problem on this test is when you run in your instance the modules are owned by the user that setup the Instance while the tests expects to be owned by ERP5TestCaseUser.

This change update the ownership of the modules to be on the expected user used by the tests (which is mostly safe even in production).
parent b2721927
...@@ -11,6 +11,13 @@ class TestSlapOSGroupRoleSecurityMixin(testSlapOSMixin): ...@@ -11,6 +11,13 @@ class TestSlapOSGroupRoleSecurityMixin(testSlapOSMixin):
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
def changeOwnership(self, document):
""" Change the ownership of the document to the right and
expected user. Normally the user which setups the site.
"""
document.changeOwnership(getSecurityManager().getUser(), False)
document.updateLocalRolesOnSecurityGroups()
def generateNewId(self): def generateNewId(self):
return self.getPortalObject().portal_ids.generateNewId( return self.getPortalObject().portal_ids.generateNewId(
id_group=('slapos_core_test')) id_group=('slapos_core_test'))
...@@ -155,6 +162,7 @@ class TestComputerModel(TestSlapOSGroupRoleSecurityMixin): ...@@ -155,6 +162,7 @@ class TestComputerModel(TestSlapOSGroupRoleSecurityMixin):
class TestComputerModelModule(TestSlapOSGroupRoleSecurityMixin): class TestComputerModelModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.computer_model_module module = self.portal.computer_model_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', 'R-MEMBER', self.user_id], False) ['G-COMPANY', 'R-MEMBER', self.user_id], False)
self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author']) self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author'])
...@@ -164,6 +172,7 @@ class TestComputerModelModule(TestSlapOSGroupRoleSecurityMixin): ...@@ -164,6 +172,7 @@ class TestComputerModelModule(TestSlapOSGroupRoleSecurityMixin):
class TestComputerModule(TestSlapOSGroupRoleSecurityMixin): class TestComputerModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.computer_module module = self.portal.computer_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', 'R-COMPUTER', 'R-MEMBER', 'R-SHADOW-PERSON', self.user_id], ['G-COMPANY', 'R-COMPUTER', 'R-MEMBER', 'R-SHADOW-PERSON', self.user_id],
False) False)
...@@ -202,6 +211,7 @@ class TestComputerNetwork(TestSlapOSGroupRoleSecurityMixin): ...@@ -202,6 +211,7 @@ class TestComputerNetwork(TestSlapOSGroupRoleSecurityMixin):
class TestComputerNetworkModule(TestSlapOSGroupRoleSecurityMixin): class TestComputerNetworkModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.computer_network_module module = self.portal.computer_network_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', 'R-MEMBER', 'R-SHADOW-PERSON', self.user_id], False) ['G-COMPANY', 'R-MEMBER', 'R-SHADOW-PERSON', self.user_id], False)
self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author']) self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author'])
...@@ -262,6 +272,7 @@ class TestComputerPartition(TestSlapOSGroupRoleSecurityMixin): ...@@ -262,6 +272,7 @@ class TestComputerPartition(TestSlapOSGroupRoleSecurityMixin):
class TestCredentialUpdateModule(TestSlapOSGroupRoleSecurityMixin): class TestCredentialUpdateModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.credential_update_module module = self.portal.credential_update_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
[self.user_id, 'R-MEMBER', 'G-COMPANY'], False) [self.user_id, 'R-MEMBER', 'G-COMPANY'], False)
self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author']) self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author'])
...@@ -285,6 +296,7 @@ class TestDataSet(TestSlapOSGroupRoleSecurityMixin): ...@@ -285,6 +296,7 @@ class TestDataSet(TestSlapOSGroupRoleSecurityMixin):
class TestDataSetModule(TestSlapOSGroupRoleSecurityMixin): class TestDataSetModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.data_set_module module = self.portal.data_set_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', 'R-COMPUTER', 'R-INSTANCE', 'R-MEMBER', self.user_id], False) ['G-COMPANY', 'R-COMPUTER', 'R-INSTANCE', 'R-MEMBER', self.user_id], False)
self.assertRoles(module, 'R-COMPUTER', ['Author']) self.assertRoles(module, 'R-COMPUTER', ['Author'])
...@@ -296,6 +308,7 @@ class TestDataSetModule(TestSlapOSGroupRoleSecurityMixin): ...@@ -296,6 +308,7 @@ class TestDataSetModule(TestSlapOSGroupRoleSecurityMixin):
class TestDocumentModule(TestSlapOSGroupRoleSecurityMixin): class TestDocumentModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.document_module module = self.portal.document_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['R-COMPUTER', 'R-INSTANCE', 'R-MEMBER', self.user_id, 'G-COMPANY'], False) ['R-COMPUTER', 'R-INSTANCE', 'R-MEMBER', self.user_id, 'G-COMPANY'], False)
self.assertRoles(module, 'R-COMPUTER', ['Author']) self.assertRoles(module, 'R-COMPUTER', ['Author'])
...@@ -369,6 +382,7 @@ class TestHostingSubscription(TestSlapOSGroupRoleSecurityMixin): ...@@ -369,6 +382,7 @@ class TestHostingSubscription(TestSlapOSGroupRoleSecurityMixin):
class TestHostingSubscriptionModule(TestSlapOSGroupRoleSecurityMixin): class TestHostingSubscriptionModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.hosting_subscription_module module = self.portal.hosting_subscription_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', 'R-COMPUTER', 'R-MEMBER', 'R-INSTANCE', self.user_id], False) ['G-COMPANY', 'R-COMPUTER', 'R-MEMBER', 'R-INSTANCE', self.user_id], False)
self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author']) self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author'])
...@@ -396,6 +410,7 @@ class TestImage(TestSlapOSGroupRoleSecurityMixin): ...@@ -396,6 +410,7 @@ class TestImage(TestSlapOSGroupRoleSecurityMixin):
class TestImageModule(TestSlapOSGroupRoleSecurityMixin): class TestImageModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.image_module module = self.portal.image_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['R-COMPUTER', 'R-INSTANCE', 'R-MEMBER', self.user_id, 'G-COMPANY'], False) ['R-COMPUTER', 'R-INSTANCE', 'R-MEMBER', self.user_id, 'G-COMPANY'], False)
self.assertRoles(module, 'R-COMPUTER', ['Author']) self.assertRoles(module, 'R-COMPUTER', ['Author'])
...@@ -421,6 +436,7 @@ class TestOrganisation(TestSlapOSGroupRoleSecurityMixin): ...@@ -421,6 +436,7 @@ class TestOrganisation(TestSlapOSGroupRoleSecurityMixin):
class TestOrganisationModule(TestSlapOSGroupRoleSecurityMixin): class TestOrganisationModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.organisation_module module = self.portal.organisation_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', 'R-COMPUTER', 'R-MEMBER', self.user_id, 'R-SHADOW-PERSON'], False) ['G-COMPANY', 'R-COMPUTER', 'R-MEMBER', self.user_id, 'R-SHADOW-PERSON'], False)
self.assertRoles(module, 'R-MEMBER', ['Auditor']) self.assertRoles(module, 'R-MEMBER', ['Auditor'])
...@@ -472,6 +488,7 @@ class TestPerson(TestSlapOSGroupRoleSecurityMixin): ...@@ -472,6 +488,7 @@ class TestPerson(TestSlapOSGroupRoleSecurityMixin):
class TestPersonModule(TestSlapOSGroupRoleSecurityMixin): class TestPersonModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.person_module module = self.portal.person_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', 'R-MEMBER', self.user_id, 'R-SHADOW-PERSON'], False) ['G-COMPANY', 'R-MEMBER', self.user_id, 'R-SHADOW-PERSON'], False)
self.assertRoles(module, 'R-MEMBER', ['Auditor']) self.assertRoles(module, 'R-MEMBER', ['Auditor'])
...@@ -613,6 +630,7 @@ class TestSoftwareInstallation(TestSlapOSGroupRoleSecurityMixin): ...@@ -613,6 +630,7 @@ class TestSoftwareInstallation(TestSlapOSGroupRoleSecurityMixin):
class TestSoftwareInstallationModule(TestSlapOSGroupRoleSecurityMixin): class TestSoftwareInstallationModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.software_installation_module module = self.portal.software_installation_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', 'R-MEMBER', 'R-COMPUTER', self.user_id], False) ['G-COMPANY', 'R-MEMBER', 'R-COMPUTER', self.user_id], False)
self.assertRoles(module, 'R-COMPUTER', ['Auditor']) self.assertRoles(module, 'R-COMPUTER', ['Auditor'])
...@@ -678,6 +696,7 @@ class TestSoftwareInstance(TestSlapOSGroupRoleSecurityMixin): ...@@ -678,6 +696,7 @@ class TestSoftwareInstance(TestSlapOSGroupRoleSecurityMixin):
class TestSoftwareInstanceModule(TestSlapOSGroupRoleSecurityMixin): class TestSoftwareInstanceModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.software_instance_module module = self.portal.software_instance_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', 'R-COMPUTER', 'R-INSTANCE', 'R-MEMBER', self.user_id], False) ['G-COMPANY', 'R-COMPUTER', 'R-INSTANCE', 'R-MEMBER', self.user_id], False)
self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author']) self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author'])
...@@ -702,6 +721,7 @@ class TestSoftwareProduct(TestSlapOSGroupRoleSecurityMixin): ...@@ -702,6 +721,7 @@ class TestSoftwareProduct(TestSlapOSGroupRoleSecurityMixin):
class TestSoftwareProductModule(TestSlapOSGroupRoleSecurityMixin): class TestSoftwareProductModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.software_product_module module = self.portal.software_product_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', 'R-MEMBER', self.user_id], False) ['G-COMPANY', 'R-MEMBER', self.user_id], False)
self.assertRoles(module, 'R-MEMBER', ['Auditor']) self.assertRoles(module, 'R-MEMBER', ['Auditor'])
...@@ -724,6 +744,7 @@ class TestSoftwareRelease(TestSlapOSGroupRoleSecurityMixin): ...@@ -724,6 +744,7 @@ class TestSoftwareRelease(TestSlapOSGroupRoleSecurityMixin):
class TestSoftwareReleaseModule(TestSlapOSGroupRoleSecurityMixin): class TestSoftwareReleaseModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.software_release_module module = self.portal.software_release_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', 'R-MEMBER', self.user_id], False) ['G-COMPANY', 'R-MEMBER', self.user_id], False)
self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author']) self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author'])
...@@ -767,6 +788,7 @@ class TestText(TestSlapOSGroupRoleSecurityMixin): ...@@ -767,6 +788,7 @@ class TestText(TestSlapOSGroupRoleSecurityMixin):
class TestContributionTool(TestSlapOSGroupRoleSecurityMixin): class TestContributionTool(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.portal_contributions module = self.portal.portal_contributions
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['R-COMPUTER', 'R-INSTANCE', 'R-MEMBER', self.user_id, 'G-COMPANY'], True) ['R-COMPUTER', 'R-INSTANCE', 'R-MEMBER', self.user_id, 'G-COMPANY'], True)
self.assertRoles(module, 'R-COMPUTER', ['Author']) self.assertRoles(module, 'R-COMPUTER', ['Author'])
...@@ -778,6 +800,7 @@ class TestContributionTool(TestSlapOSGroupRoleSecurityMixin): ...@@ -778,6 +800,7 @@ class TestContributionTool(TestSlapOSGroupRoleSecurityMixin):
class TestOpenSaleOrderModule(TestSlapOSGroupRoleSecurityMixin): class TestOpenSaleOrderModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.open_sale_order_module module = self.portal.open_sale_order_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], False) ['G-COMPANY', self.user_id], False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -796,6 +819,7 @@ class TestOpenSaleOrder(TestSlapOSGroupRoleSecurityMixin): ...@@ -796,6 +819,7 @@ class TestOpenSaleOrder(TestSlapOSGroupRoleSecurityMixin):
class TestSaleOrderModule(TestSlapOSGroupRoleSecurityMixin): class TestSaleOrderModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.sale_order_module module = self.portal.sale_order_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], True) ['G-COMPANY', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -814,6 +838,7 @@ class TestSaleOrder(TestSlapOSGroupRoleSecurityMixin): ...@@ -814,6 +838,7 @@ class TestSaleOrder(TestSlapOSGroupRoleSecurityMixin):
class TestSalePackingListModule(TestSlapOSGroupRoleSecurityMixin): class TestSalePackingListModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.sale_packing_list_module module = self.portal.sale_packing_list_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id, 'R-MEMBER'], False) ['G-COMPANY', self.user_id, 'R-MEMBER'], False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -867,6 +892,7 @@ class TestSalePackingList(TestSlapOSGroupRoleSecurityMixin): ...@@ -867,6 +892,7 @@ class TestSalePackingList(TestSlapOSGroupRoleSecurityMixin):
class TestAccountingTransactionModule(TestSlapOSGroupRoleSecurityMixin): class TestAccountingTransactionModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.accounting_module module = self.portal.accounting_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id, 'R-SHADOW-PERSON', 'R-MEMBER'], True) ['G-COMPANY', self.user_id, 'R-SHADOW-PERSON', 'R-MEMBER'], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -979,6 +1005,7 @@ class TestSaleInvoiceTransaction(TestSlapOSGroupRoleSecurityMixin): ...@@ -979,6 +1005,7 @@ class TestSaleInvoiceTransaction(TestSlapOSGroupRoleSecurityMixin):
class TestServiceModule(TestSlapOSGroupRoleSecurityMixin): class TestServiceModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.service_module module = self.portal.service_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id, 'R-MEMBER'], True) ['G-COMPANY', self.user_id, 'R-MEMBER'], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -999,6 +1026,7 @@ class TestService(TestSlapOSGroupRoleSecurityMixin): ...@@ -999,6 +1026,7 @@ class TestService(TestSlapOSGroupRoleSecurityMixin):
class TestAccountModule(TestSlapOSGroupRoleSecurityMixin): class TestAccountModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.account_module module = self.portal.account_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id, 'R-SHADOW-PERSON', 'R-MEMBER'], False) ['G-COMPANY', self.user_id, 'R-SHADOW-PERSON', 'R-MEMBER'], False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1021,6 +1049,7 @@ class TestAccount(TestSlapOSGroupRoleSecurityMixin): ...@@ -1021,6 +1049,7 @@ class TestAccount(TestSlapOSGroupRoleSecurityMixin):
class TestCurrencyModule(TestSlapOSGroupRoleSecurityMixin): class TestCurrencyModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.currency_module module = self.portal.currency_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id, 'R-SHADOW-PERSON', 'R-MEMBER'], True) ['G-COMPANY', self.user_id, 'R-SHADOW-PERSON', 'R-MEMBER'], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1043,6 +1072,7 @@ class TestCurrency(TestSlapOSGroupRoleSecurityMixin): ...@@ -1043,6 +1072,7 @@ class TestCurrency(TestSlapOSGroupRoleSecurityMixin):
class TestSaleTradeConditionModule(TestSlapOSGroupRoleSecurityMixin): class TestSaleTradeConditionModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.sale_trade_condition_module module = self.portal.sale_trade_condition_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id, 'R-MEMBER'], False) ['G-COMPANY', self.user_id, 'R-MEMBER'], False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1125,6 +1155,7 @@ class TestBankAccount(TestSlapOSGroupRoleSecurityMixin): ...@@ -1125,6 +1155,7 @@ class TestBankAccount(TestSlapOSGroupRoleSecurityMixin):
class TestCampaignModule(TestSlapOSGroupRoleSecurityMixin): class TestCampaignModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.campaign_module module = self.portal.campaign_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], True) ['G-COMPANY', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1154,6 +1185,7 @@ class TestCashRegister(TestSlapOSGroupRoleSecurityMixin): ...@@ -1154,6 +1185,7 @@ class TestCashRegister(TestSlapOSGroupRoleSecurityMixin):
class TestComponentModule(TestSlapOSGroupRoleSecurityMixin): class TestComponentModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.component_module module = self.portal.component_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], True) ['G-COMPANY', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1183,6 +1215,7 @@ class TestCreditCard(TestSlapOSGroupRoleSecurityMixin): ...@@ -1183,6 +1215,7 @@ class TestCreditCard(TestSlapOSGroupRoleSecurityMixin):
class TestDocumentIngestionModule(TestSlapOSGroupRoleSecurityMixin): class TestDocumentIngestionModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.document_ingestion_module module = self.portal.document_ingestion_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], True) ['G-COMPANY', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1191,6 +1224,7 @@ class TestDocumentIngestionModule(TestSlapOSGroupRoleSecurityMixin): ...@@ -1191,6 +1224,7 @@ class TestDocumentIngestionModule(TestSlapOSGroupRoleSecurityMixin):
class TestEventModule(TestSlapOSGroupRoleSecurityMixin): class TestEventModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.event_module module = self.portal.event_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', 'R-MEMBER', self.user_id], True) ['G-COMPANY', 'R-MEMBER', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1250,6 +1284,7 @@ class TestGadget(TestSlapOSGroupRoleSecurityMixin): ...@@ -1250,6 +1284,7 @@ class TestGadget(TestSlapOSGroupRoleSecurityMixin):
class TestGadgetTool(TestSlapOSGroupRoleSecurityMixin): class TestGadgetTool(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.portal_gadgets module = self.portal.portal_gadgets
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], True) ['G-COMPANY', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1268,6 +1303,7 @@ class TestInventory(TestSlapOSGroupRoleSecurityMixin): ...@@ -1268,6 +1303,7 @@ class TestInventory(TestSlapOSGroupRoleSecurityMixin):
class TestInventoryModule(TestSlapOSGroupRoleSecurityMixin): class TestInventoryModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.inventory_module module = self.portal.inventory_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], False) ['G-COMPANY', self.user_id], False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1297,6 +1333,7 @@ class TestKnowledgePad(TestSlapOSGroupRoleSecurityMixin): ...@@ -1297,6 +1333,7 @@ class TestKnowledgePad(TestSlapOSGroupRoleSecurityMixin):
class TestKnowledgePadModule(TestSlapOSGroupRoleSecurityMixin): class TestKnowledgePadModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.knowledge_pad_module module = self.portal.knowledge_pad_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], False) ['G-COMPANY', self.user_id], False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1395,6 +1432,7 @@ class TestMeeting(TestSlapOSGroupRoleSecurityMixin): ...@@ -1395,6 +1432,7 @@ class TestMeeting(TestSlapOSGroupRoleSecurityMixin):
class TestMeetingModule(TestSlapOSGroupRoleSecurityMixin): class TestMeetingModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.meeting_module module = self.portal.meeting_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], True) ['G-COMPANY', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1523,6 +1561,7 @@ class TestVisit(TestSlapOSGroupRoleSecurityMixin): ...@@ -1523,6 +1561,7 @@ class TestVisit(TestSlapOSGroupRoleSecurityMixin):
class TestNotificationMessageModule(TestSlapOSGroupRoleSecurityMixin): class TestNotificationMessageModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.notification_message_module module = self.portal.notification_message_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], False) ['G-COMPANY', self.user_id], False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1541,6 +1580,7 @@ class TestNotificationMessage(TestSlapOSGroupRoleSecurityMixin): ...@@ -1541,6 +1580,7 @@ class TestNotificationMessage(TestSlapOSGroupRoleSecurityMixin):
class TestProductModule(TestSlapOSGroupRoleSecurityMixin): class TestProductModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.product_module module = self.portal.product_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], True) ['G-COMPANY', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1559,6 +1599,7 @@ class TestProduct(TestSlapOSGroupRoleSecurityMixin): ...@@ -1559,6 +1599,7 @@ class TestProduct(TestSlapOSGroupRoleSecurityMixin):
class TestPurchaseOrderModule(TestSlapOSGroupRoleSecurityMixin): class TestPurchaseOrderModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.purchase_order_module module = self.portal.purchase_order_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], True) ['G-COMPANY', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1577,6 +1618,7 @@ class TestPurchaseOrder(TestSlapOSGroupRoleSecurityMixin): ...@@ -1577,6 +1618,7 @@ class TestPurchaseOrder(TestSlapOSGroupRoleSecurityMixin):
class TestPurchaseTradeConditionModule(TestSlapOSGroupRoleSecurityMixin): class TestPurchaseTradeConditionModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.purchase_trade_condition_module module = self.portal.purchase_trade_condition_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], True) ['G-COMPANY', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1595,6 +1637,7 @@ class TestPurchaseTradeCondition(TestSlapOSGroupRoleSecurityMixin): ...@@ -1595,6 +1637,7 @@ class TestPurchaseTradeCondition(TestSlapOSGroupRoleSecurityMixin):
class TestQueryModule(TestSlapOSGroupRoleSecurityMixin): class TestQueryModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.query_module module = self.portal.query_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], False) ['G-COMPANY', self.user_id], False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1613,6 +1656,7 @@ class TestQuery(TestSlapOSGroupRoleSecurityMixin): ...@@ -1613,6 +1656,7 @@ class TestQuery(TestSlapOSGroupRoleSecurityMixin):
class TestSaleOpportunityModule(TestSlapOSGroupRoleSecurityMixin): class TestSaleOpportunityModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.sale_opportunity_module module = self.portal.sale_opportunity_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], True) ['G-COMPANY', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1764,6 +1808,7 @@ class TestWebMessage(TestSlapOSGroupRoleSecurityMixin): ...@@ -1764,6 +1808,7 @@ class TestWebMessage(TestSlapOSGroupRoleSecurityMixin):
class TestSupportRequestModule(TestSlapOSGroupRoleSecurityMixin): class TestSupportRequestModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.support_request_module module = self.portal.support_request_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', 'R-MEMBER', self.user_id], True) ['G-COMPANY', 'R-MEMBER', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1811,6 +1856,7 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin): ...@@ -1811,6 +1856,7 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
class TestTransformationModule(TestSlapOSGroupRoleSecurityMixin): class TestTransformationModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.transformation_module module = self.portal.transformation_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], True) ['G-COMPANY', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1829,6 +1875,7 @@ class TestTransformation(TestSlapOSGroupRoleSecurityMixin): ...@@ -1829,6 +1875,7 @@ class TestTransformation(TestSlapOSGroupRoleSecurityMixin):
class TestWebPageModule(TestSlapOSGroupRoleSecurityMixin): class TestWebPageModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.web_page_module module = self.portal.web_page_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], True) ['G-COMPANY', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1847,6 +1894,7 @@ class TestWebPage(TestSlapOSGroupRoleSecurityMixin): ...@@ -1847,6 +1894,7 @@ class TestWebPage(TestSlapOSGroupRoleSecurityMixin):
class TestIntegrationTool(TestSlapOSGroupRoleSecurityMixin): class TestIntegrationTool(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.portal_integrations module = self.portal.portal_integrations
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['R-SHADOW-PERSON', 'ERP5TypeTestCase', 'G-COMPANY'], False) ['R-SHADOW-PERSON', 'ERP5TypeTestCase', 'G-COMPANY'], False)
self.assertRoles(module, 'R-SHADOW-PERSON', ['Auditor']) self.assertRoles(module, 'R-SHADOW-PERSON', ['Auditor'])
...@@ -1856,6 +1904,7 @@ class TestIntegrationTool(TestSlapOSGroupRoleSecurityMixin): ...@@ -1856,6 +1904,7 @@ class TestIntegrationTool(TestSlapOSGroupRoleSecurityMixin):
class TestIntegrationSite(TestSlapOSGroupRoleSecurityMixin): class TestIntegrationSite(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.portal_integrations module = self.portal.portal_integrations
self.changeOwnership(module)
product = module.newContent( product = module.newContent(
portal_type='Integration Site') portal_type='Integration Site')
self.assertSecurityGroup(product, self.assertSecurityGroup(product,
...@@ -1867,6 +1916,7 @@ class TestIntegrationSite(TestSlapOSGroupRoleSecurityMixin): ...@@ -1867,6 +1916,7 @@ class TestIntegrationSite(TestSlapOSGroupRoleSecurityMixin):
class TestSystemEventModule(TestSlapOSGroupRoleSecurityMixin): class TestSystemEventModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.system_event_module module = self.portal.system_event_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['R-SHADOW-PERSON', self.user_id, 'G-COMPANY'], False) ['R-SHADOW-PERSON', self.user_id, 'G-COMPANY'], False)
self.assertRoles(module, 'R-SHADOW-PERSON', ['Author']) self.assertRoles(module, 'R-SHADOW-PERSON', ['Author'])
...@@ -1919,6 +1969,7 @@ class TestSecurePaymentTool(TestSlapOSGroupRoleSecurityMixin): ...@@ -1919,6 +1969,7 @@ class TestSecurePaymentTool(TestSlapOSGroupRoleSecurityMixin):
class TestBusinessProcessModule(TestSlapOSGroupRoleSecurityMixin): class TestBusinessProcessModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.business_process_module module = self.portal.business_process_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id, 'R-MEMBER'], False) ['G-COMPANY', self.user_id, 'R-MEMBER'], False)
self.assertRoles(module, 'G-COMPANY', ['Auditor']) self.assertRoles(module, 'G-COMPANY', ['Auditor'])
...@@ -1939,6 +1990,7 @@ class TestBusinessProcess(TestSlapOSGroupRoleSecurityMixin): ...@@ -1939,6 +1990,7 @@ class TestBusinessProcess(TestSlapOSGroupRoleSecurityMixin):
class TestRegularisationRequestModule(TestSlapOSGroupRoleSecurityMixin): class TestRegularisationRequestModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.regularisation_request_module module = self.portal.regularisation_request_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', 'R-MEMBER', self.user_id], False) ['G-COMPANY', 'R-MEMBER', self.user_id], False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -1986,6 +2038,7 @@ class TestRegularisationRequest(TestSlapOSGroupRoleSecurityMixin): ...@@ -1986,6 +2038,7 @@ class TestRegularisationRequest(TestSlapOSGroupRoleSecurityMixin):
class TestAccessTokenModule(TestSlapOSGroupRoleSecurityMixin): class TestAccessTokenModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.access_token_module module = self.portal.access_token_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', 'R-MEMBER', self.user_id], False) ['G-COMPANY', 'R-MEMBER', self.user_id], False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
...@@ -2015,6 +2068,7 @@ class TestRestrictedAccessToken(TestSlapOSGroupRoleSecurityMixin): ...@@ -2015,6 +2068,7 @@ class TestRestrictedAccessToken(TestSlapOSGroupRoleSecurityMixin):
class TestConsumptionDocumentModule(TestSlapOSGroupRoleSecurityMixin): class TestConsumptionDocumentModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.consumption_document_module module = self.portal.consumption_document_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['R-COMPUTER', 'R-MEMBER', self.user_id, 'G-COMPANY'], False) ['R-COMPUTER', 'R-MEMBER', self.user_id, 'G-COMPANY'], False)
self.assertRoles(module, 'R-COMPUTER', ['Author']) self.assertRoles(module, 'R-COMPUTER', ['Author'])
...@@ -2063,6 +2117,7 @@ class TestUserConsumptionHTMLFile(TestSlapOSGroupRoleSecurityMixin): ...@@ -2063,6 +2117,7 @@ class TestUserConsumptionHTMLFile(TestSlapOSGroupRoleSecurityMixin):
class TestCloudContractModule(TestSlapOSGroupRoleSecurityMixin): class TestCloudContractModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.cloud_contract_module module = self.portal.cloud_contract_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
[self.user_id, 'G-COMPANY'], False) [self.user_id, 'G-COMPANY'], False)
self.assertRoles(module, 'G-COMPANY', ['Author', 'Auditor']) self.assertRoles(module, 'G-COMPANY', ['Author', 'Auditor'])
...@@ -2082,6 +2137,7 @@ class TestCloudContract(TestSlapOSGroupRoleSecurityMixin): ...@@ -2082,6 +2137,7 @@ class TestCloudContract(TestSlapOSGroupRoleSecurityMixin):
class TestUpgradeDecisionModule(TestSlapOSGroupRoleSecurityMixin): class TestUpgradeDecisionModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.upgrade_decision_module module = self.portal.upgrade_decision_module
self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', 'R-MEMBER', self.user_id], True) ['G-COMPANY', 'R-MEMBER', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
......
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