Commit 6425d6ff authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Test ComputeNode_getTicketRelatedList

parent 43d57bc8
......@@ -8,14 +8,15 @@ uid_list = [context.getUid()]
computer_partition_uid_list = [
cp.getUid() for cp in context.contentValues(portal_type="Compute Partition") if cp.getSlapState() == 'busy']
for instance in portal.portal_catalog(
if computer_partition_uid_list:
for instance in portal.portal_catalog(
portal_type="Software Instance",
select_dict={'specialise_uid': None},
specialise_portal_type="Instance Tree",
default_aggregate_uid=computer_partition_uid_list):
if instance.specialise_uid not in uid_list:
uid_list.append(instance.specialise_uid)
if instance.specialise_uid not in uid_list:
uid_list.append(instance.specialise_uid)
kw['default_or_child_aggregate_uid'] = uid_list
return context.Base_getOpenRelatedTicketList(**kw)
......@@ -156,6 +156,303 @@ class TestSlapOSSupportRequestModule_getMonitoringUrlList(TestCRMSkinsMixin):
self.tic()
self.assertNotEqual(instance_tree.getSuccessorList(), [])
class TestSlapOSComputeNode_getTicketRelatedList(TestCRMSkinsMixin):
def test_getTicketRelatedList_support_request_related_to_allocated_instance(self):
document = self._makeComputeNode()[0]
self._makeComplexComputeNode()
ticket = self.portal.support_request_module.newContent(\
title="Test Support Request %s" % self.new_id)
ticket.setAggregateValue(self.start_requested_software_instance.getSpecialiseValue())
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
# Not indexed yet
self.assertEqual(len(open_related_ticket_list), 0)
self.tic()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 0)
ticket.submit()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
ticket.validate()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
ticket.suspend()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
ticket.invalidate()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
def test_getTicketRelatedList_support_request_related_to_compute_node(self):
document = self._makeComputeNode()[0]
ticket = self.portal.support_request_module.newContent(\
title="Test Support Request %s" % self.new_id)
ticket.setAggregateValue(document)
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
# Not indexed yet
self.assertEqual(len(open_related_ticket_list), 0)
self.tic()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 0)
ticket.submit()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
ticket.validate()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
ticket.suspend()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
ticket.invalidate()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
def test_getTicketRelatedList_cancelled_support_request_related_to_allocated_instance(self):
document = self._makeComputeNode()[0]
self._makeComplexComputeNode()
ticket = self.portal.support_request_module.newContent(\
title="Test Support Request %s" % self.new_id)
ticket.setAggregateValue(self.start_requested_software_instance.getSpecialiseValue())
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
# Not indexed yet
self.assertEqual(len(open_related_ticket_list), 0)
self.tic()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 0)
ticket.submit()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
ticket.cancel()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 0)
def test_getTicketRelatedList_cancelled_support_request_related_to_compute_node(self):
document = self._makeComputeNode()[0]
ticket = self.portal.support_request_module.newContent(\
title="Test Support Request %s" % self.new_id)
ticket.setAggregateValue(document)
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
# Not indexed yet
self.assertEqual(len(open_related_ticket_list), 0)
self.tic()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 0)
ticket.submit()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
ticket.cancel()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 0)
def test_getTicketRelatedList_upgrade_decision_related_to_allocated_instance(self):
document = self._makeComputeNode()[0]
self._makeComplexComputeNode()
def newUpgradeDecision():
ticket = self.portal.upgrade_decision_module.newContent(
portal_type='Upgrade Decision',
title="Upgrade Decision Test %s" % self.new_id,
reference="TESTUD-%s" % self.new_id)
ticket.immediateReindexObject()
return ticket
ticket = newUpgradeDecision()
ticket.newContent(
portal_type="Upgrade Decision Line"
).setAggregateValue(
self.start_requested_software_instance.getSpecialiseValue())
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
# Not indexed yet
self.assertEqual(len(open_related_ticket_list), 0)
self.tic()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 0)
ticket.plan()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 0)
ticket.confirm()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
ticket.start()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
ticket.stop()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
ticket.deliver()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
def test_getTicketRelatedList_upgrade_decision_related_to_compute_node(self):
document = self._makeComputeNode()[0]
def newUpgradeDecision():
ticket = self.portal.upgrade_decision_module.newContent(
portal_type='Upgrade Decision',
title="Upgrade Decision Test %s" % self.new_id,
reference="TESTUD-%s" % self.new_id)
ticket.immediateReindexObject()
return ticket
ticket = newUpgradeDecision()
ticket.newContent(
portal_type="Upgrade Decision Line"
).setAggregateValue(document)
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
# Not indexed yet
self.assertEqual(len(open_related_ticket_list), 0)
self.tic()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 0)
ticket.plan()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 0)
ticket.confirm()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
ticket.start()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
ticket.stop()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
ticket.deliver()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 1)
self.assertEqual(open_related_ticket_list[0].getUid(), ticket.getUid())
def test_getTicketRelatedList_cancelled_upgrade_decision_to_allocated_instance(self):
document = self._makeComputeNode()[0]
self._makeComplexComputeNode()
def newUpgradeDecision():
ticket = self.portal.upgrade_decision_module.newContent(
portal_type='Upgrade Decision',
title="Upgrade Decision Test %s" % self.new_id,
reference="TESTUD-%s" % self.new_id)
ticket.immediateReindexObject()
return ticket
ticket = newUpgradeDecision()
ticket.newContent(
portal_type="Upgrade Decision Line"
).setAggregateValue(
self.start_requested_software_instance.getSpecialiseValue())
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
# Not indexed yet
self.assertEqual(len(open_related_ticket_list), 0)
self.tic()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 0)
ticket.cancel()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 0)
def test_getTicketRelatedList_cancelled_upgrade_decision_to_computer_node(self):
document = self._makeComputeNode()[0]
def newUpgradeDecision():
ticket = self.portal.upgrade_decision_module.newContent(
portal_type='Upgrade Decision',
title="Upgrade Decision Test %s" % self.new_id,
reference="TESTUD-%s" % self.new_id)
ticket.immediateReindexObject()
return ticket
ticket = newUpgradeDecision()
ticket.newContent(
portal_type="Upgrade Decision Line"
).setAggregateValue(document)
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
# Not indexed yet
self.assertEqual(len(open_related_ticket_list), 0)
self.tic()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 0)
ticket.cancel()
ticket.immediateReindexObject()
open_related_ticket_list = document.ComputeNode_getTicketRelatedList()
self.assertEqual(len(open_related_ticket_list), 0)
class TestSlapOSBase_getOpenRelatedTicketList(TestCRMSkinsMixin):
def test_getOpenRelatedTicketList_support_request_related_to_compute_node(self):
......@@ -220,7 +517,6 @@ class TestSlapOSBase_getOpenRelatedTicketList(TestCRMSkinsMixin):
open_related_ticket_list = document.Base_getOpenRelatedTicketList()
# Not indexed yet
self.assertEqual(len(open_related_ticket_list), 0)
self.tic()
open_related_ticket_list = document.Base_getOpenRelatedTicketList()
......
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