Commit b361ceea authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5: test Instance/Remote Nodes local roles

parent 83aa35c2
...@@ -437,6 +437,68 @@ class TestComputeNode(TestSlapOSGroupRoleSecurityMixin): ...@@ -437,6 +437,68 @@ class TestComputeNode(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(compute_node, '%s_R-INSTANCE' % project.getReference(), ['Auditor']) self.assertRoles(compute_node, '%s_R-INSTANCE' % project.getReference(), ['Auditor'])
class TestInstanceNode(TestSlapOSGroupRoleSecurityMixin):
def test_InstanceNode_userId(self):
compute_node = self.portal.compute_node_module.newContent(portal_type='Instance Node')
self.assertSecurityGroup(compute_node,
[self.user_id], False)
self.assertRoles(compute_node, self.user_id, ['Owner'])
compute_node.edit(user_id=None)
self.assertSecurityGroup(compute_node,
[self.user_id], False)
self.assertRoles(compute_node, self.user_id, ['Owner'])
def test_InstanceNode_ProjectMember(self):
project = self.addProject()
compute_node = self.portal.compute_node_module.newContent(
portal_type='Instance Node')
compute_node.edit(
follow_up_value=project)
self.assertSecurityGroup(compute_node, [
self.user_id,
'%s_F-PRODAGNT' % project.getReference(),
'%s_F-PRODMAN' % project.getReference(),
'%s_F-CUSTOMER' % project.getReference(),
], False)
self.assertRoles(compute_node, self.user_id, ['Owner'])
self.assertRoles(compute_node, '%s_F-PRODAGNT' % project.getReference(), ['Assignee'])
self.assertRoles(compute_node, '%s_F-PRODMAN' % project.getReference(), ['Assignor'])
self.assertRoles(compute_node, '%s_F-CUSTOMER' % project.getReference(), ['Auditor'])
class TestRemoteNode(TestSlapOSGroupRoleSecurityMixin):
def test_RemoteNode_userId(self):
compute_node = self.portal.compute_node_module.newContent(portal_type='Remote Node')
self.assertSecurityGroup(compute_node,
[self.user_id], False)
self.assertRoles(compute_node, self.user_id, ['Owner'])
compute_node.edit(user_id=None)
self.assertSecurityGroup(compute_node,
[self.user_id], False)
self.assertRoles(compute_node, self.user_id, ['Owner'])
def test_RemoteNode_ProjectMember(self):
project = self.addProject()
compute_node = self.portal.compute_node_module.newContent(
portal_type='Remote Node')
compute_node.edit(
follow_up_value=project)
self.assertSecurityGroup(compute_node, [
self.user_id,
'%s_F-PRODAGNT' % project.getReference(),
'%s_F-PRODMAN' % project.getReference(),
'%s_F-CUSTOMER' % project.getReference(),
], False)
self.assertRoles(compute_node, self.user_id, ['Owner'])
self.assertRoles(compute_node, '%s_F-PRODAGNT' % project.getReference(), ['Assignee'])
self.assertRoles(compute_node, '%s_F-PRODMAN' % project.getReference(), ['Assignor'])
self.assertRoles(compute_node, '%s_F-CUSTOMER' % project.getReference(), ['Auditor'])
class TestComputerModelModule(TestSlapOSGroupRoleSecurityMixin): class TestComputerModelModule(TestSlapOSGroupRoleSecurityMixin):
def test_ComputerModelModule(self): def test_ComputerModelModule(self):
module = self.portal.computer_model_module module = self.portal.computer_model_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