Commit 8fcb03d5 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Deliver stopped Events from Regularisation Request

   Rename *[sS]toppedEventToDeliver to *[sS]toppedEventFromSupportRequestToDeliver to reflect proper usage
   Add *[sS]toppedFromEventRegularisationRequestToDeliver to handle delivering of Events from Regularisation Request via new alarm
   Update and add tests accordingly.
   Narrow the slapos_crm_interaction_workflow to only trigger alarm if the follow up portal type is relevant, to not over trigger the alarm on excessive amount of occasions.
parent fe4cda5d
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Alarm" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_checkStoppedEventFromRegularisationRequestToDeliver</string> </value>
</item>
<item>
<key> <string>automatic_solve</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>slapos_crm_check_stopped_event_from_regularisation_request_to_deliver</string> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_hour_frequency</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute_frequency</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_frequency</string> </key>
<value> <int>12</int> </value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="DateTime" module="DateTime.DateTime"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<tuple>
<float>1288051200.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>sense_method_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Check stopped event from regularisation request to deliver</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>active_sense_method_id</string> </key> <key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_checkStoppedEventToDeliver</string> </value> <value> <string>Alarm_checkStoppedEventFromSupportRequestToDeliver</string> </value>
</item> </item>
<item> <item>
<key> <string>automatic_solve</string> </key> <key> <string>automatic_solve</string> </key>
...@@ -16,7 +16,9 @@ ...@@ -16,7 +16,9 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Check if a public or a friend compute_node contacted master recently and create a ticket if the compute_node stops to contact master after some time.</string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
...@@ -24,7 +26,7 @@ ...@@ -24,7 +26,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>slapos_crm_check_stopped_event_to_deliver</string> </value> <value> <string>slapos_crm_check_stopped_event_from_support_request_to_deliver</string> </value>
</item> </item>
<item> <item>
<key> <string>periodicity_hour</string> </key> <key> <string>periodicity_hour</string> </key>
......
portal = context.getPortalObject()
activate_kw = {'tag': tag}
portal.portal_catalog.searchAndActivate(
portal_type=portal.getPortalEventTypeList(),
simulation_state='stopped',
follow_up__portal_type='Regularisation Request',
method_id='Event_checkStoppedFromRegularisationRequestToDeliver',
method_kw={'activate_kw': activate_kw},
activate_kw=activate_kw
)
context.activate(after_tag=tag).getId()
<?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>tag, fixit, params</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_checkStoppedEventFromRegularisationRequestToDeliver</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
event = context
if event.getSimulationState() != 'stopped':
return
ticket = event.getFollowUpValue(portal_type='Regularisation Request')
if ticket is None:
# No ticket, don't try doing anything
return
if ticket.getSimulationState() not in ['invalidated', 'validated']:
# Do nothing for suspended tickets
return
comment = 'Ticket was %s' % ticket.getSimulationState()
is_event_older_than_ticket_modification = (event.getCreationDate() <= ticket.getModificationDate())
if not is_event_older_than_ticket_modification:
comment = 'Ticket has been modified'
ticket.edit(activate_kw=activate_kw)
event.deliver(comment=comment)
event.reindexObject(activate_kw=activate_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>activate_kw=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Event_checkStoppedFromRegularisationRequestToDeliver</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -5,7 +5,7 @@ portal.portal_catalog.searchAndActivate( ...@@ -5,7 +5,7 @@ portal.portal_catalog.searchAndActivate(
portal_type=portal.getPortalEventTypeList(), portal_type=portal.getPortalEventTypeList(),
simulation_state='stopped', simulation_state='stopped',
follow_up__portal_type='Support Request', follow_up__portal_type='Support Request',
method_id='Event_checkStoppedToDeliver', method_id='Event_checkStoppedFromSupportRequestToDeliver',
method_kw={'activate_kw': activate_kw}, method_kw={'activate_kw': activate_kw},
activate_kw=activate_kw activate_kw=activate_kw
) )
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Alarm_checkStoppedEventToDeliver</string> </value> <value> <string>Alarm_checkStoppedEventFromSupportRequestToDeliver</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Event_checkStoppedToDeliver</string> </value> <value> <string>Event_checkStoppedFromSupportRequestToDeliver</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
from erp5.component.test.SlapOSTestCaseMixin import \ from erp5.component.test.SlapOSTestCaseMixin import \
SlapOSTestCaseMixin, SlapOSTestCaseMixinWithAbort, simulate, TemporaryAlarmScript SlapOSTestCaseMixin, SlapOSTestCaseMixinWithAbort, simulate, TemporaryAlarmScript
from DateTime import DateTime from DateTime import DateTime
import time
import difflib import difflib
import transaction import transaction
from zExceptions import Unauthorized from zExceptions import Unauthorized
...@@ -1250,3 +1251,155 @@ class TestSlapOSCrmDeleteInstanceTree(SlapOSTestCaseMixinWithAbort): ...@@ -1250,3 +1251,155 @@ class TestSlapOSCrmDeleteInstanceTree(SlapOSTestCaseMixinWithAbort):
self.tic() self.tic()
class TestSlaposCrmCheckStoppedEventFromRegularisationRequestToDeliver(SlapOSTestCaseMixinWithAbort):
ticket_portal_type = 'Regularisation Request'
event_portal_type = 'Web Message'
def _makeTicket(self):
ticket = self.portal.getDefaultModule(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type
)
ticket.submit()
new_id = self.generateNewId()
ticket.edit(
title= "%s éçà %s" % (self.ticket_portal_type, new_id), #pylint: disable=invalid-encoded-data
reference="TESTTCK-%s" % new_id
)
return ticket
def _makeEvent(self, ticket):
new_id = self.generateNewId()
return self.portal.event_module.newContent(
portal_type=self.event_portal_type,
title='Test %s %s' % (self.event_portal_type, new_id),
follow_up_value=ticket
)
def test_Event_checkStoppedEventFromRegularisationRequestToDeliver_alarm_stopped(self):
ticket = self._makeTicket()
event = self._makeEvent(ticket)
event.stop()
with TemporaryAlarmScript(self.portal, 'Base_reindexAndSenseAlarm', "'disabled'", attribute='comment'):
self.tic()
alarm = self.portal.portal_alarms.\
slapos_crm_check_stopped_event_from_regularisation_request_to_deliver
self._test_alarm(alarm, event, "Event_checkStoppedFromRegularisationRequestToDeliver")
def test_Event_checkStoppedEventFromRegularisationRequestToDeliver_alarm_delivered(self):
ticket = self._makeTicket()
event = self._makeEvent(ticket)
event.stop()
event.deliver()
with TemporaryAlarmScript(self.portal, 'Base_reindexAndSenseAlarm', "'disabled'", attribute='comment'):
self.tic()
alarm = self.portal.portal_alarms.\
slapos_crm_check_stopped_event_from_regularisation_request_to_deliver
self._test_alarm_not_visited(alarm, event, "Event_checkStoppedFromRegularisationRequestToDeliver")
def test_Event_checkStoppedEventFromRegularisationRequestToDeliver_alarm_stoppedWithoutTicket(self):
ticket = self._makeTicket()
event = self._makeEvent(ticket)
event.setFollowUp(None)
event.stop()
with TemporaryAlarmScript(self.portal, 'Base_reindexAndSenseAlarm', "'disabled'", attribute='comment'):
self.tic()
alarm = self.portal.portal_alarms.\
slapos_crm_check_stopped_event_from_regularisation_request_to_deliver
self._test_alarm_not_visited(alarm, event, "Event_checkStoppedFromRegularisationRequestToDeliver")
def test_Event_checkStoppedEventFromRegularisationRequestToDeliver_script_recentEventInvalidatedTicket(self):
ticket = self._makeTicket()
ticket.validate()
ticket.invalidate()
self.tic()
time.sleep(1)
event = self._makeEvent(ticket)
event.stop()
with TemporaryAlarmScript(self.portal, 'Base_reindexAndSenseAlarm', "'disabled'", attribute='comment'):
self.tic()
self.assertEqual(event.getSimulationState(), "stopped")
self.assertEqual(ticket.getSimulationState(), "invalidated")
event.Event_checkStoppedFromRegularisationRequestToDeliver()
self.assertEqual(event.getSimulationState(), "delivered")
self.assertEqual(ticket.getSimulationState(), "invalidated")
def test_Event_checkStoppedEventFromRegularisationRequestToDeliver_script_recentEventValidatedTicket(self):
ticket = self._makeTicket()
ticket.validate()
self.tic()
time.sleep(1)
event = self._makeEvent(ticket)
event.stop()
with TemporaryAlarmScript(self.portal, 'Base_reindexAndSenseAlarm', "'disabled'", attribute='comment'):
self.tic()
self.assertEqual(event.getSimulationState(), "stopped")
self.assertEqual(ticket.getSimulationState(), "validated")
event.Event_checkStoppedFromRegularisationRequestToDeliver()
self.assertEqual(event.getSimulationState(), "delivered")
self.assertTrue(event.getCreationDate() < ticket.getModificationDate())
self.assertEqual(ticket.getSimulationState(), "validated")
def test_Event_checkStoppedEventFromRegularisationRequestToDeliver_script_recentEventSuspendedTicket(self):
ticket = self._makeTicket()
ticket.validate()
ticket.suspend()
self.tic()
time.sleep(1)
event = self._makeEvent(ticket)
event.stop()
with TemporaryAlarmScript(self.portal, 'Base_reindexAndSenseAlarm', "'disabled'", attribute='comment'):
self.tic()
self.assertEqual(event.getSimulationState(), "stopped")
self.assertEqual(ticket.getSimulationState(), "suspended")
event.Event_checkStoppedFromRegularisationRequestToDeliver()
self.assertEqual(event.getSimulationState(), "stopped")
self.assertEqual(ticket.getSimulationState(), "suspended")
def test_Event_checkStoppedEventFromRegularisationRequestToDeliver_script_oldEventInvalidatedTicket(self):
ticket = self._makeTicket()
event = self._makeEvent(ticket)
event.stop()
with TemporaryAlarmScript(self.portal, 'Base_reindexAndSenseAlarm', "'disabled'", attribute='comment'):
self.tic()
time.sleep(1)
ticket.validate()
ticket.invalidate()
self.tic()
self.assertEqual(event.getSimulationState(), "stopped")
self.assertEqual(ticket.getSimulationState(), "invalidated")
event.Event_checkStoppedFromRegularisationRequestToDeliver()
self.assertEqual(event.getSimulationState(), "delivered")
self.assertEqual(ticket.getSimulationState(), "invalidated")
def test_Event_checkStoppedEventFromRegularisationRequestToDeliver_script_oldEventValidatedTicket(self):
ticket = self._makeTicket()
event = self._makeEvent(ticket)
event.stop()
with TemporaryAlarmScript(self.portal, 'Base_reindexAndSenseAlarm', "'disabled'", attribute='comment'):
self.tic()
time.sleep(1)
ticket.validate()
self.tic()
self.assertEqual(event.getSimulationState(), "stopped")
self.assertEqual(ticket.getSimulationState(), "validated")
event.Event_checkStoppedFromRegularisationRequestToDeliver()
self.assertEqual(event.getSimulationState(), "delivered")
self.assertEqual(ticket.getSimulationState(), "validated")
def test_Event_checkStoppedEventFromRegularisationRequestToDeliver_script_oldEventSuspendedTicket(self):
ticket = self._makeTicket()
event = self._makeEvent(ticket)
event.stop()
with TemporaryAlarmScript(self.portal, 'Base_reindexAndSenseAlarm', "'disabled'", attribute='comment'):
self.tic()
time.sleep(1)
ticket.validate()
ticket.suspend()
self.tic()
self.assertEqual(event.getSimulationState(), "stopped")
self.assertEqual(ticket.getSimulationState(), "suspended")
event.Event_checkStoppedFromRegularisationRequestToDeliver()
self.assertEqual(event.getSimulationState(), "stopped")
self.assertEqual(ticket.getSimulationState(), "suspended")
...@@ -1175,17 +1175,17 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort): ...@@ -1175,17 +1175,17 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort):
follow_up_value=ticket follow_up_value=ticket
) )
def test_Event_checkStoppedEventToDeliver_alarm_stopped(self): def test_Event_checkStoppedEventFromSupportRequestToDeliver_alarm_stopped(self):
support_request = self._makeSupportRequest() support_request = self._makeSupportRequest()
event = self._makeEvent(support_request) event = self._makeEvent(support_request)
event.stop() event.stop()
with TemporaryAlarmScript(self.portal, 'Base_reindexAndSenseAlarm', "'disabled'", attribute='comment'): with TemporaryAlarmScript(self.portal, 'Base_reindexAndSenseAlarm', "'disabled'", attribute='comment'):
self.tic() self.tic()
alarm = self.portal.portal_alarms.\ alarm = self.portal.portal_alarms.\
slapos_crm_check_stopped_event_to_deliver slapos_crm_check_stopped_event_from_support_request_to_deliver
self._test_alarm(alarm, event, "Event_checkStoppedToDeliver") self._test_alarm(alarm, event, "Event_checkStoppedFromSupportRequestToDeliver")
def test_Event_checkStoppedEventToDeliver_alarm_delivered(self): def test_Event_checkStoppedEventFromSupportRequestToDeliver_alarm_delivered(self):
support_request = self._makeSupportRequest() support_request = self._makeSupportRequest()
event = self._makeEvent(support_request) event = self._makeEvent(support_request)
event.stop() event.stop()
...@@ -1193,10 +1193,10 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort): ...@@ -1193,10 +1193,10 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort):
with TemporaryAlarmScript(self.portal, 'Base_reindexAndSenseAlarm', "'disabled'", attribute='comment'): with TemporaryAlarmScript(self.portal, 'Base_reindexAndSenseAlarm', "'disabled'", attribute='comment'):
self.tic() self.tic()
alarm = self.portal.portal_alarms.\ alarm = self.portal.portal_alarms.\
slapos_crm_check_stopped_event_to_deliver slapos_crm_check_stopped_event_from_support_request_to_deliver
self._test_alarm_not_visited(alarm, event, "Event_checkStoppedToDeliver") self._test_alarm_not_visited(alarm, event, "Event_checkStoppedFromSupportRequestToDeliver")
def test_Event_checkStoppedEventToDeliver_alarm_stoppedWithoutTicket(self): def test_Event_checkStoppedEventFromSupportRequestToDeliver_alarm_stoppedWithoutTicket(self):
support_request = self._makeSupportRequest() support_request = self._makeSupportRequest()
event = self._makeEvent(support_request) event = self._makeEvent(support_request)
event.setFollowUp(None) event.setFollowUp(None)
...@@ -1204,10 +1204,10 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort): ...@@ -1204,10 +1204,10 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort):
with TemporaryAlarmScript(self.portal, 'Base_reindexAndSenseAlarm', "'disabled'", attribute='comment'): with TemporaryAlarmScript(self.portal, 'Base_reindexAndSenseAlarm', "'disabled'", attribute='comment'):
self.tic() self.tic()
alarm = self.portal.portal_alarms.\ alarm = self.portal.portal_alarms.\
slapos_crm_check_stopped_event_to_deliver slapos_crm_check_stopped_event_from_support_request_to_deliver
self._test_alarm_not_visited(alarm, event, "Event_checkStoppedToDeliver") self._test_alarm_not_visited(alarm, event, "Event_checkStoppedFromSupportRequestToDeliver")
def test_Event_checkStoppedEventToDeliver_script_recentEventInvalidatedTicket(self): def test_Event_checkStoppedEventFromSupportRequestToDeliver_script_recentEventInvalidatedTicket(self):
support_request = self._makeSupportRequest() support_request = self._makeSupportRequest()
support_request.validate() support_request.validate()
support_request.invalidate() support_request.invalidate()
...@@ -1219,11 +1219,11 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort): ...@@ -1219,11 +1219,11 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort):
self.tic() self.tic()
self.assertEqual(event.getSimulationState(), "stopped") self.assertEqual(event.getSimulationState(), "stopped")
self.assertEqual(support_request.getSimulationState(), "invalidated") self.assertEqual(support_request.getSimulationState(), "invalidated")
event.Event_checkStoppedToDeliver() event.Event_checkStoppedFromSupportRequestToDeliver()
self.assertEqual(event.getSimulationState(), "delivered") self.assertEqual(event.getSimulationState(), "delivered")
self.assertEqual(support_request.getSimulationState(), "validated") self.assertEqual(support_request.getSimulationState(), "validated")
def test_Event_checkStoppedEventToDeliver_script_recentEventValidatedTicket(self): def test_Event_checkStoppedEventFromSupportRequestToDeliver_script_recentEventValidatedTicket(self):
support_request = self._makeSupportRequest() support_request = self._makeSupportRequest()
support_request.validate() support_request.validate()
self.tic() self.tic()
...@@ -1234,11 +1234,11 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort): ...@@ -1234,11 +1234,11 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort):
self.tic() self.tic()
self.assertEqual(event.getSimulationState(), "stopped") self.assertEqual(event.getSimulationState(), "stopped")
self.assertEqual(support_request.getSimulationState(), "validated") self.assertEqual(support_request.getSimulationState(), "validated")
event.Event_checkStoppedToDeliver() event.Event_checkStoppedFromSupportRequestToDeliver()
self.assertEqual(event.getSimulationState(), "delivered") self.assertEqual(event.getSimulationState(), "delivered")
self.assertTrue(event.getCreationDate() < support_request.getModificationDate()) self.assertTrue(event.getCreationDate() < support_request.getModificationDate())
def test_Event_checkStoppedEventToDeliver_script_recentEventSuspendedTicket(self): def test_Event_checkStoppedEventFromSupportRequestToDeliver_script_recentEventSuspendedTicket(self):
support_request = self._makeSupportRequest() support_request = self._makeSupportRequest()
support_request.validate() support_request.validate()
support_request.suspend() support_request.suspend()
...@@ -1250,11 +1250,11 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort): ...@@ -1250,11 +1250,11 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort):
self.tic() self.tic()
self.assertEqual(event.getSimulationState(), "stopped") self.assertEqual(event.getSimulationState(), "stopped")
self.assertEqual(support_request.getSimulationState(), "suspended") self.assertEqual(support_request.getSimulationState(), "suspended")
event.Event_checkStoppedToDeliver() event.Event_checkStoppedFromSupportRequestToDeliver()
self.assertEqual(event.getSimulationState(), "stopped") self.assertEqual(event.getSimulationState(), "stopped")
self.assertEqual(support_request.getSimulationState(), "suspended") self.assertEqual(support_request.getSimulationState(), "suspended")
def test_Event_checkStoppedEventToDeliver_script_oldEventInvalidatedTicket(self): def test_Event_checkStoppedEventFromSupportRequestToDeliver_script_oldEventInvalidatedTicket(self):
support_request = self._makeSupportRequest() support_request = self._makeSupportRequest()
event = self._makeEvent(support_request) event = self._makeEvent(support_request)
event.stop() event.stop()
...@@ -1266,11 +1266,11 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort): ...@@ -1266,11 +1266,11 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort):
self.tic() self.tic()
self.assertEqual(event.getSimulationState(), "stopped") self.assertEqual(event.getSimulationState(), "stopped")
self.assertEqual(support_request.getSimulationState(), "invalidated") self.assertEqual(support_request.getSimulationState(), "invalidated")
event.Event_checkStoppedToDeliver() event.Event_checkStoppedFromSupportRequestToDeliver()
self.assertEqual(event.getSimulationState(), "delivered") self.assertEqual(event.getSimulationState(), "delivered")
self.assertEqual(support_request.getSimulationState(), "invalidated") self.assertEqual(support_request.getSimulationState(), "invalidated")
def test_Event_checkStoppedEventToDeliver_script_oldEventValidatedTicket(self): def test_Event_checkStoppedEventFromSupportRequestToDeliver_script_oldEventValidatedTicket(self):
support_request = self._makeSupportRequest() support_request = self._makeSupportRequest()
event = self._makeEvent(support_request) event = self._makeEvent(support_request)
event.stop() event.stop()
...@@ -1281,11 +1281,11 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort): ...@@ -1281,11 +1281,11 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort):
self.tic() self.tic()
self.assertEqual(event.getSimulationState(), "stopped") self.assertEqual(event.getSimulationState(), "stopped")
self.assertEqual(support_request.getSimulationState(), "validated") self.assertEqual(support_request.getSimulationState(), "validated")
event.Event_checkStoppedToDeliver() event.Event_checkStoppedFromSupportRequestToDeliver()
self.assertEqual(event.getSimulationState(), "delivered") self.assertEqual(event.getSimulationState(), "delivered")
self.assertEqual(support_request.getSimulationState(), "validated") self.assertEqual(support_request.getSimulationState(), "validated")
def test_Event_checkStoppedEventToDeliver_script_oldEventSuspendedTicket(self): def test_Event_checkStoppedEventFromSupportRequestToDeliver_script_oldEventSuspendedTicket(self):
support_request = self._makeSupportRequest() support_request = self._makeSupportRequest()
event = self._makeEvent(support_request) event = self._makeEvent(support_request)
event.stop() event.stop()
...@@ -1297,7 +1297,7 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort): ...@@ -1297,7 +1297,7 @@ class TestSlaposCrmCheckStoppedEventToDeliver(SlapOSTestCaseMixinWithAbort):
self.tic() self.tic()
self.assertEqual(event.getSimulationState(), "stopped") self.assertEqual(event.getSimulationState(), "stopped")
self.assertEqual(support_request.getSimulationState(), "suspended") self.assertEqual(support_request.getSimulationState(), "suspended")
event.Event_checkStoppedToDeliver() event.Event_checkStoppedFromSupportRequestToDeliver()
self.assertEqual(event.getSimulationState(), "stopped") self.assertEqual(event.getSimulationState(), "stopped")
self.assertEqual(support_request.getSimulationState(), "suspended") self.assertEqual(support_request.getSimulationState(), "suspended")
......
event = state_change['object'] event = state_change['object']
return event.Base_reindexAndSenseAlarm(['slapos_crm_check_stopped_event_to_deliver']) ticket = event.getFollowUpValue()
if ticket is None:
return
if ticket.getPortalType() == 'Support Request':
return event.Base_reindexAndSenseAlarm(
['slapos_crm_check_stopped_event_from_support_request_to_deliver'])
elif ticket.getPortalType() == 'Regularisation Request':
return event.Base_reindexAndSenseAlarm(
['slapos_crm_check_stopped_event_from_regularisation_request_to_deliver'])
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