Commit 538aa080 authored by Romain Courteaud's avatar Romain Courteaud

slapos_subscription_request: test: SubscriptionRequest_verifyInstanceIsAllocated was dropped

parent 2deabf92
......@@ -711,98 +711,6 @@ class TestSubscriptionRequest_notifyInstanceIsReady(TestSubscriptionSkinsMixin):
self.instance_tree.getRelativeUrl()))
class TestSubscriptionRequest_verifyInstanceIsAllocated(TestSubscriptionSkinsMixin):
@simulate('SoftwareInstance_hasReportedError', '', 'return False')
def test_instance_tree(self):
person = self.makePerson()
subscription_request = self.newSubscriptionRequest(
quantity=1, destination_section_value=person,
url_string="https://%s/software.cfg" % self.new_id,
sla_xml="""<?xml version="1.0" encoding="utf-8"?>
<instance>
<parameter id="oi">couscous</parameter>
<parameter id="zz">yy</parameter>
</instance>""",
text_content="""<?xml version="1.0" encoding="utf-8"?>
<instance>
<parameter id="xx">couscous</parameter>
<parameter id="zz">yy</parameter>
</instance>""",
root_slave=False,
source_reference="test_for_test_123")
self._makeTree()
subscription_request.edit(
aggregate_value=self.instance_tree
)
# Ensure the requested instances aren't allocated
self.assertEqual(self.requested_software_instance.getAggregate(), None)
self.assertEqual(self.software_instance.getAggregate(), None)
self.tic()
self.assertEqual(
subscription_request.SubscriptionRequest_verifyInstanceIsAllocated(), False)
def _test_instance_tree(self, slave=False):
person = self.makePerson()
subscription_request = self.newSubscriptionRequest(
quantity=1, destination_section_value=person,
url_string="https://%s/software.cfg" % self.new_id,
sla_xml="""<?xml version="1.0" encoding="utf-8"?>
<instance>
<parameter id="oi">couscous</parameter>
<parameter id="zz">yy</parameter>
</instance>""",
text_content="""<?xml version="1.0" encoding="utf-8"?>
<instance>
<parameter id="xx">couscous</parameter>
<parameter id="zz">yy</parameter>
</instance>""",
root_slave=False,
source_reference="test_for_test_123")
if slave:
self._makeSlaveTree()
_, p0 = self._makeComputeNode()
self.software_instance.setAggregateValue(p0)
self.requested_software_instance.setSpecialise(None)
else:
self._makeTree()
_, p0 = self._makeComputeNode()
_, p1 = self._makeComputeNode()
# Ensure the requested instances aren't allocated
self.requested_software_instance.setAggregateValue(p1)
self.software_instance.setAggregateValue(p0)
subscription_request.edit(
aggregate_value=self.instance_tree
)
self.tic()
return subscription_request
@simulate('SoftwareInstance_hasReportedError', '', 'return True')
def test_instance_tree_instance_with_error(self):
subscription_request = self._test_instance_tree()
self.assertEqual(
subscription_request.SubscriptionRequest_verifyInstanceIsAllocated(), False)
@simulate('SoftwareInstance_hasReportedError', '', 'return False')
def test_instance_tree_instance_without_error(self):
subscription_request = self._test_instance_tree()
self.assertEqual(
subscription_request.SubscriptionRequest_verifyInstanceIsAllocated(), True)
@simulate('SoftwareInstance_hasReportedError', '', 'return True')
def test_instance_tree_slave_with_error(self):
subscription_request = self._test_instance_tree(slave=True)
self.assertEqual(
subscription_request.SubscriptionRequest_verifyInstanceIsAllocated(), True)
class TestSlapOSSubscriptionRequestModule_getTicketFeedUrl(TestSubscriptionSkinsMixin):
def test_getTicketFeedUrl(self):
......
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