Commit 01e8a5ed authored by Alain Takoudjou's avatar Alain Takoudjou

slapos_erp5: add new tests for consumption document

parent d13e45dc
......@@ -2016,8 +2016,9 @@ class TestConsumptionDocumentModule(TestSlapOSGroupRoleSecurityMixin):
def test(self):
module = self.portal.consumption_document_module
self.assertSecurityGroup(module,
['R-COMPUTER', 'zope', 'G-COMPANY'], False)
['R-COMPUTER', 'R-MEMBER', 'zope', 'G-COMPANY'], False)
self.assertRoles(module, 'R-COMPUTER', ['Author'])
self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author'])
self.assertRoles(module, 'G-COMPANY', ['Author', 'Auditor'])
self.assertRoles(module, 'zope', ['Owner'])
......@@ -2032,6 +2033,33 @@ class TestComputerConsumptionTioXMLFile(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(text, 'G-COMPANY', ['Assignor'])
self.assertRoles(text, self.user_id, ['Owner'])
class TestUserConsumptionHTMLFile(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self):
text = self.portal.consumption_document_module.newContent(
portal_type='User Consumption HTML File')
self.assertSecurityGroup(text,
['G-COMPANY', self.user_id],
False)
self.assertRoles(text, 'G-COMPANY', ['Assignor'])
self.assertRoles(text, self.user_id, ['Owner'])
def test_CustomerAssignee(self):
customer_reference = 'TESTPERSON-%s' % self.generateNewId()
customer = self.portal.person_module.newContent(
portal_type='Person', reference=customer_reference)
reference = 'TESTRC-%s' % self.generateNewId()
html_document = self.portal.consumption_document_module.newContent(
portal_type='User Consumption HTML File', reference=reference,
contributor=customer.getRelativeUrl())
html_document.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(html_document,
['G-COMPANY', customer_reference, self.user_id], False)
self.assertRoles(html_document, 'G-COMPANY', ['Assignor'])
self.assertRoles(html_document, customer_reference, ['Assignee'])
self.assertRoles(html_document, self.user_id, ['Owner'])
class TestCloudContractModule(TestSlapOSGroupRoleSecurityMixin):
def test(self):
module = self.portal.cloud_contract_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