Commit d5534cf7 authored by Romain Courteaud's avatar Romain Courteaud

slapos_cloud: fix requestComputeNode tests

parent 1cd44196
......@@ -616,6 +616,8 @@ class TestSlapOSCorePersonRequestComputeNode(SlapOSTestCaseMixin):
SlapOSTestCaseMixin.afterSetUp(self)
self.project = self.addProject()
person_user = self.makePerson(self.project)
# Only admin can create computer node
self.addProjectProductionManagerAssignment(person_user, self.project)
self.tic()
# Login as new user
......@@ -626,19 +628,24 @@ class TestSlapOSCorePersonRequestComputeNode(SlapOSTestCaseMixin):
def beforeTearDown(self):
pass
def test_request_requiredParameter(self):
def test_requestComputeNode_requiredParameter(self):
person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
# compute_node_title is mandatory
self.assertRaises(TypeError, person.requestComputeNode,
project_reference=self.project.getReference())
# if provided does not raise
compute_node_title = self.generateNewComputeNodeTitle()
# project_reference is mandatory
self.assertRaises(TypeError, person.requestComputeNode,
compute_node_title=compute_node_title)
# if provided does not raise
person.requestComputeNode(project_reference=self.project.getReference(),
compute_node_title=compute_node_title)
def test_request(self):
def test_requestComputeNode_request(self):
person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
compute_node_title = self.generateNewComputeNodeTitle()
......@@ -654,7 +661,7 @@ class TestSlapOSCorePersonRequestComputeNode(SlapOSTestCaseMixin):
self.assertNotEqual(None, compute_node_absolute_url)
self.assertNotEqual(None, compute_node_reference)
def test_request_createdComputeNode(self):
def test_requestComputeNode_createdComputeNode(self):
person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
previous_id = self.getPortalObject().portal_ids\
......@@ -683,10 +690,10 @@ class TestSlapOSCorePersonRequestComputeNode(SlapOSTestCaseMixin):
self.assertEqual(compute_node_reference, compute_node.getReference())
self.assertEqual('COMP-%s' % (previous_id + 1), compute_node.getReference())
self.assertEqual('validated', compute_node.getValidationState())
self.assertEqual(None, compute_node.getAllocationScope())
self.assertEqual('open', compute_node.getCapacityScope())
self.assertEqual('open', compute_node.getAllocationScope())
self.assertEqual('close', compute_node.getCapacityScope())
def test_request_notReindexedCompute(self):
def test_requestComputeNode_notReindexedCompute(self):
person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
compute_node_title = self.generateNewComputeNodeTitle()
......@@ -697,7 +704,7 @@ class TestSlapOSCorePersonRequestComputeNode(SlapOSTestCaseMixin):
project_reference=self.project.getReference(),
compute_node_title=compute_node_title)
def test_multiple_request_createdComputeNode(self):
def test_requestComputeNode_multiple_request_createdComputeNode(self):
person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
previous_id = self.getPortalObject().portal_ids\
......@@ -727,7 +734,7 @@ class TestSlapOSCorePersonRequestComputeNode(SlapOSTestCaseMixin):
self.assertEqual(compute_node_reference, compute_node.getReference())
self.assertEqual('COMP-%s' % (previous_id + 1), compute_node.getReference())
self.assertEqual('validated', compute_node.getValidationState())
self.assertEqual('open/personal', compute_node.getAllocationScope())
self.assertEqual('open', compute_node.getAllocationScope())
self.assertEqual('close', compute_node.getCapacityScope())
self.tic()
......@@ -754,7 +761,7 @@ class TestSlapOSCorePersonRequestComputeNode(SlapOSTestCaseMixin):
self.assertEqual(compute_node_reference, compute_node.getReference())
self.assertEqual('COMP-%s' % (previous_id + 1), compute_node.getReference())
self.assertEqual('validated', compute_node.getValidationState())
self.assertEqual('open/personal', compute_node.getAllocationScope())
self.assertEqual('open', compute_node.getAllocationScope())
self.assertEqual('close', compute_node.getCapacityScope())
# and now another one
......@@ -782,10 +789,10 @@ class TestSlapOSCorePersonRequestComputeNode(SlapOSTestCaseMixin):
self.assertEqual(compute_node_reference2, compute_node2.getReference())
self.assertEqual('COMP-%s' % (previous_id + 2), compute_node2.getReference())
self.assertEqual('validated', compute_node2.getValidationState())
self.assertEqual('open/personal', compute_node2.getAllocationScope())
self.assertEqual('open', compute_node2.getAllocationScope())
self.assertEqual('close', compute_node2.getCapacityScope())
def test_request_duplicatedComputeNode(self):
def test_requestComputeNode_duplicatedComputeNode(self):
person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
compute_node_title = self.generateNewComputeNodeTitle()
......
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