Commit 450019fe authored by Romain Courteaud's avatar Romain Courteaud

slapos_cloud: project in test

parent 48856b4e
......@@ -273,6 +273,8 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
project_reference=project.getReference()
)
self.person_user = self.makePerson(project, new_id=new_id, index=False)
self.commit()
# prepare part of tree
self.instance_tree = self.portal.instance_tree_module\
.template_instance_tree.Base_createCloneDocument(batch_mode=1)
......@@ -288,6 +290,7 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
sla_xml=self.request_kw['sla_xml'],
root_slave=self.request_kw['shared'],
successor=self.software_instance.getRelativeUrl(),
destination_section_value=self.person_user,
follow_up_value=project
)
self.instance_tree.validate()
......
......@@ -78,7 +78,7 @@ return True""" )
@simulate('Person_isAllowedToAllocate', '*args, **kwargs', 'return True')
def test_allocation_no_free_partition(self):
self._makeTreeself.project()
self._makeTree(self.project)
self.assertEqual(None, self.software_instance.getAggregateValue(
portal_type='Compute Partition'))
......@@ -205,48 +205,6 @@ return True""" )
self.assertEqual(None,
self.software_instance.getAggregate(portal_type='Compute Partition'))
@simulate('Person_isAllowedToAllocate', '*args, **kwargs', 'return True')
def test_allocation_allocation_scope_open_personal(self):
self._makeTree(self.project)
self._makeComputeNode(self.project)
self._installSoftware(self.compute_node,
self.software_instance.getUrlString())
self.compute_node.edit(allocation_scope='open/personal',
source_administration=self.person_user.getRelativeUrl())
self.compute_node.setAccessStatus("#access ok")
self.tic()
self.compute_node.ComputeNode_checkAndUpdateCapacityScope()
self.assertEqual(self.compute_node.getCapacityScope(), 'open')
self.tic()
self.assertEqual(None, self.software_instance.getAggregateValue(
portal_type='Compute Partition'))
self.software_instance.SoftwareInstance_tryToAllocatePartition()
self.assertEqual(self.partition.getRelativeUrl(),
self.software_instance.getAggregate(portal_type='Compute Partition'))
@simulate('Person_isAllowedToAllocate', '*args, **kwargs', 'return True')
def test_allocation_host_allocation_scope_open_personal(self):
self._makeSlaveTree(self.project)
self._makeComputeNode(self.project)
self._allocateHost(self.requested_software_instance,
self.partition)
self.compute_node.edit(allocation_scope='open/personal',
source_administration=self.person_user.getRelativeUrl())
self.compute_node.setAccessStatus("#access ok")
self.tic()
self.compute_node.ComputeNode_checkAndUpdateCapacityScope()
self.assertEqual(self.compute_node.getCapacityScope(), 'open')
self.tic()
self.assertEqual(None, self.software_instance.getAggregateValue(
portal_type='Compute Partition'))
self.software_instance.SoftwareInstance_tryToAllocatePartition()
self.assertEqual(self.partition.getRelativeUrl(),
self.software_instance.getAggregate(portal_type='Compute Partition'))
@simulate('Person_isAllowedToAllocate', '*args, **kwargs', 'return True')
def test_allocation_does_not_fail_on_instance_with_damaged_sla_xml(self):
self._makeTree(self.project)
......@@ -356,7 +314,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
self._makeTree(self.project)
self._makeComputeNode(self.project)
self.assertEqual(self.compute_node.getAllocationScope(), "open/public")
self.assertEqual(self.compute_node.getAllocationScope(), "open")
self.assertEqual(self.compute_node.getCapacityScope(), "open")
self._installSoftware(self.compute_node,
......@@ -489,6 +447,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
text_content=self.generateSafeXml(),
sla_xml=sla_xml,
specialise=self.instance_tree.getRelativeUrl(),
follow_up_value=self.project
)
self.portal.portal_workflow._jumpToStateFor(software_instance2, 'start_requested')
self.portal.portal_workflow._jumpToStateFor(software_instance2, 'validated')
......@@ -583,6 +542,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
text_content=self.generateSafeXml(),
sla_xml=sla_xml,
specialise=self.instance_tree.getRelativeUrl(),
follow_up_value=self.project
)
self.portal.portal_workflow._jumpToStateFor(software_instance2, 'start_requested')
software_instance2.validate()
......@@ -603,6 +563,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
text_content=self.generateSafeXml(),
sla_xml=sla_xml,
specialise=self.instance_tree.getRelativeUrl(),
follow_up_value=self.project
)
self.portal.portal_workflow._jumpToStateFor(software_instance3, 'start_requested')
software_instance3.validate()
......@@ -711,6 +672,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
text_content=self.generateSafeXml(),
sla_xml=sla_xml,
specialise=self.instance_tree.getRelativeUrl(),
follow_up_value=self.project
)
self.portal.portal_workflow._jumpToStateFor(software_instance2, 'start_requested')
self.portal.portal_workflow._jumpToStateFor(software_instance2, 'validated')
......
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