Commit 1f4dceeb authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5: test Person local roles

parent 3c31284f
......@@ -1743,3 +1743,47 @@ class TestService(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(delivery, 'F-CUSTOMER', ['Auditor'])
self.assertRoles(delivery, 'F-PRODUCTION*', ['Auditor'])
class TestPersonModule(TestSlapOSGroupRoleSecurityMixin):
def test_PersonModule(self):
module = self.portal.person_module
self.assertSecurityGroup(module,
['F-SALE*', 'F-ACCOUNTING*', 'F-CUSTOMER', 'F-PRODUCTION*',
'R-SHADOW-PERSON', module.Base_getOwnerId()], False)
self.assertRoles(module, 'F-SALE*', ['Auditor', 'Author'])
self.assertRoles(module, 'F-ACCOUNTING*', ['Auditor', 'Author'])
self.assertRoles(module, 'F-CUSTOMER', ['Auditor'])
self.assertRoles(module, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(module, 'F-PRODUCTION*', ['Auditor'])
self.assertRoles(module, module.Base_getOwnerId(), ['Owner'])
class TestPerson(TestSlapOSGroupRoleSecurityMixin):
def test_Person_default(self):
delivery = self.portal.person_module.newContent(
portal_type='Person')
self.assertSecurityGroup(delivery,
['F-ACCMAN', 'F-SALEAGT', 'F-ACCAGT', 'F-SALEMAN',
self.user_id], False)
self.assertRoles(delivery, self.user_id, ['Owner'])
self.assertRoles(delivery, 'F-SALEAGT', ['Assignee'])
self.assertRoles(delivery, 'F-SALEMAN', ['Assignor'])
self.assertRoles(delivery, 'F-ACCMAN', ['Assignor'])
self.assertRoles(delivery, 'F-ACCAGT', ['Assignee'])
def test_Person_selfUser(self):
delivery = self.portal.person_module.newContent(
portal_type='Person')
delivery.newContent(portal_type='ERP5 Login')
self.assertSecurityGroup(delivery,
['F-ACCMAN', 'F-SALEAGT', 'F-ACCAGT', 'F-SALEMAN',
delivery.getUserId(), 'SHADOW-%s' % delivery.getUserId(),
self.user_id], False)
self.assertRoles(delivery, self.user_id, ['Owner'])
self.assertRoles(delivery, 'F-SALEAGT', ['Assignee'])
self.assertRoles(delivery, 'F-SALEMAN', ['Assignor'])
self.assertRoles(delivery, 'F-ACCMAN', ['Assignor'])
self.assertRoles(delivery, 'F-ACCAGT', ['Assignee'])
self.assertRoles(delivery, delivery.getUserId(), ['Assignee'])
self.assertRoles(delivery, 'SHADOW-%s' % delivery.getUserId(), ['Auditor'])
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