Commit b427e4c8 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Separate tickets and upgrade decision on different listbox

  Do not browse whole related instance trees,  Only display directly related objects do keep more direct approach.
parent c3864bea
"""
Get all related tickets from the computer and everything that was allocated
on it.
"""
portal = context.getPortalObject()
uid_list = [context.getUid()]
computer_partition_uid_list = [
cp.getUid() for cp in context.contentValues(portal_type="Compute Partition") if cp.getSlapState() == 'busy']
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)
kw['default_or_child_aggregate_uid'] = uid_list
return context.Base_getOpenRelatedTicketList(**kw)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComputeNode_getTicketRelatedList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -96,7 +96,8 @@ ...@@ -96,7 +96,8 @@
<key> <string>left</string> </key> <key> <string>left</string> </key>
<value> <value>
<list> <list>
<string>my_monitor_scope</string> <string>my_reference</string>
<string>my_title</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -104,7 +105,7 @@ ...@@ -104,7 +105,7 @@
<key> <string>right</string> </key> <key> <string>right</string> </key>
<value> <value>
<list> <list>
<string>my_upgrade_scope</string> <string>my_monitor_scope</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -13,12 +13,14 @@ ...@@ -13,12 +13,14 @@
<string>columns</string> <string>columns</string>
<string>count_method</string> <string>count_method</string>
<string>default_params</string> <string>default_params</string>
<string>editable</string> <string>editable_columns</string>
<string>hide_rows_on_no_search_criterion</string> <string>hide_rows_on_no_search_criterion</string>
<string>lines</string>
<string>list_method</string> <string>list_method</string>
<string>portal_types</string>
<string>search_columns</string>
<string>selection_name</string> <string>selection_name</string>
<string>sort</string> <string>sort</string>
<string>sort_columns</string>
<string>title</string> <string>title</string>
</list> </list>
</value> </value>
...@@ -71,6 +73,12 @@ ...@@ -71,6 +73,12 @@
</item> </item>
<item> <item>
<key> <string>default_params</string> </key> <key> <string>default_params</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>editable_columns</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
...@@ -86,13 +94,15 @@ ...@@ -86,13 +94,15 @@
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>lines</string> </key> <key> <string>list_method</string> </key>
<value> <value> <string></string> </value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>list_method</string> </key> <key> <string>portal_types</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>search_columns</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
...@@ -105,10 +115,18 @@ ...@@ -105,10 +115,18 @@
<key> <string>sort</string> </key> <key> <string>sort</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>sort_columns</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>target</string> </key> <key> <string>target</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -121,20 +139,12 @@ ...@@ -121,20 +139,12 @@
<value> <value>
<list> <list>
<tuple> <tuple>
<string>title</string> <string>reference</string>
<string>Title</string> <string>Reference</string>
</tuple>
<tuple>
<string>portal_type</string>
<string>Portal Type</string>
</tuple> </tuple>
<tuple> <tuple>
<string>resource_title</string> <string>title</string>
<string>Type</string> <string>Title</string>
</tuple>
<tuple>
<string>modification_date</string>
<string>Modification Date</string>
</tuple> </tuple>
<tuple> <tuple>
<string>translated_simulation_state_title</string> <string>translated_simulation_state_title</string>
...@@ -142,7 +152,7 @@ ...@@ -142,7 +152,7 @@
</tuple> </tuple>
<tuple> <tuple>
<string>SupportRequest_recheckMonitoring</string> <string>SupportRequest_recheckMonitoring</string>
<string>Recheck</string> <string>Rechecking Monitoring</string>
</tuple> </tuple>
</list> </list>
</value> </value>
...@@ -158,8 +168,10 @@ ...@@ -158,8 +168,10 @@
</value> </value>
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable_columns</string> </key>
<value> <int>0</int> </value> <value>
<list/>
</value>
</item> </item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
...@@ -167,30 +179,72 @@ ...@@ -167,30 +179,72 @@
</item> </item>
<item> <item>
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value> <value> <string>Base_viewWebFieldLibrary</string> </value>
</item> </item>
<item> <item>
<key> <string>hide_rows_on_no_search_criterion</string> </key> <key> <string>hide_rows_on_no_search_criterion</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>lines</string> </key>
<value> <int>20</int> </value>
</item>
<item> <item>
<key> <string>list_method</string> </key> <key> <string>list_method</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
<item>
<key> <string>portal_types</string> </key>
<value>
<list>
<tuple>
<string>Support Request</string>
<string>Support Request</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>search_columns</string> </key>
<value>
<list>
<tuple>
<string>reference</string>
<string>Reference</string>
</tuple>
<tuple>
<string>title</string>
<string>Title</string>
</tuple>
<tuple>
<string>translated_simulation_state_title</string>
<string>State</string>
</tuple>
</list>
</value>
</item>
<item> <item>
<key> <string>selection_name</string> </key> <key> <string>selection_name</string> </key>
<value> <string>folder_open_ticket_rss_selection</string> </value> <value> <string>compute node_selection</string> </value>
</item> </item>
<item> <item>
<key> <string>sort</string> </key> <key> <string>sort</string> </key>
<value> <value>
<list/> <list>
<tuple>
<string>modification_date</string>
<string>Modification Date</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>sort_columns</string> </key>
<value>
<list>
<tuple>
<string>modification_date</string>
<string>Modification Date</string>
</tuple>
</list>
</value> </value>
</item> </item>
<item> <item>
...@@ -199,7 +253,7 @@ ...@@ -199,7 +253,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Ticket List</string> </value> <value> <string>Tickets</string> </value>
</item> </item>
</dictionary> </dictionary>
</value> </value>
...@@ -215,7 +269,7 @@ ...@@ -215,7 +269,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: int(here.REQUEST.get(\'size\', preferences.getPreference(\'preferred_listbox_list_mode_line_count\', 30)))</string> </value> <value> <string>python: [(\'default_aggregate_uid\', here.getUid())]</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
...@@ -228,7 +282,7 @@ ...@@ -228,7 +282,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:\'%scompute_node_support_request_selection\' % here.getId()</string> </value> <value> <string>python: \'compute_node_%s_ticket_list\' % here.getUid()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
...@@ -241,7 +295,7 @@ ...@@ -241,7 +295,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>method_name</string> </key> <key> <string>method_name</string> </key>
<value> <string>ComputeNode_getTicketRelatedList</string> </value> <value> <string>portal_catalog</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -10,15 +10,14 @@ ...@@ -10,15 +10,14 @@
<key> <string>delegated_list</string> </key> <key> <string>delegated_list</string> </key>
<value> <value>
<list> <list>
<string>default</string> <string>display_width</string>
<string>items</string> <string>editable</string>
<string>title</string>
</list> </list>
</value> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_upgrade_scope</string> </value> <value> <string>my_reference</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -43,10 +42,6 @@ ...@@ -43,10 +42,6 @@
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -54,12 +49,6 @@ ...@@ -54,12 +49,6 @@
<key> <string>tales</string> </key> <key> <string>tales</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -68,20 +57,6 @@ ...@@ -68,20 +57,6 @@
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -90,61 +65,25 @@ ...@@ -90,61 +65,25 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>default</string> </key> <key> <string>display_width</string> </key>
<value> <string></string> </value> <value> <int>20</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>my_dialog_mode_category</string> </value> <value> <string>my_view_mode_reference</string> </value>
</item> </item>
<item> <item>
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value> <value> <string>Base_viewFieldLibrary</string> </value>
</item> </item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Upgrade Scope</string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: context.getUpgradeScope()</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: getattr(here.portal_categories[field.getId().replace(\'my_\', \'\', 1)], preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\'))(local_sort_id=(\'int_index\', \'translated_title\'), checked_permission=\'View\')</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>display_width</string>
<string>editable</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_title</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_title</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -156,303 +156,6 @@ class TestSlapOSSupportRequestModule_getMonitoringUrlList(TestCRMSkinsMixin): ...@@ -156,303 +156,6 @@ class TestSlapOSSupportRequestModule_getMonitoringUrlList(TestCRMSkinsMixin):
self.tic() self.tic()
self.assertNotEqual(instance_tree.getSuccessorList(), []) 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 TestComputeNode_hasContactedRecently(SlapOSTestCaseMixinWithAbort): class TestComputeNode_hasContactedRecently(SlapOSTestCaseMixinWithAbort):
def createSPL(self, compute_node): def createSPL(self, compute_node):
......
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