Commit c44f7fd5 authored by Romain Courteaud's avatar Romain Courteaud

slapos_crm: test slapos_crm_update_support_request_state

parent 6e551a7b
...@@ -4,10 +4,10 @@ default_resource_uid = portal.restrictedTraverse("service_module/slapos_crm_moni ...@@ -4,10 +4,10 @@ default_resource_uid = portal.restrictedTraverse("service_module/slapos_crm_moni
portal.portal_catalog.searchAndActivate( portal.portal_catalog.searchAndActivate(
portal_type='Support Request', portal_type='Support Request',
simulation_state=['validated', 'suspended'], simulation_state=['validated', 'suspended'],
default_resource_uid=default_resource_uid, resource__uid=default_resource_uid,
default_aggregate_portal_type=["Instance Tree"], aggregate__portal_type=["Instance Tree"],
method_id='SupportRequest_updateMonitoringState', method_id='SupportRequest_updateMonitoringState',
activate_kw = {'tag':tag} activate_kw={'tag':tag}
) )
context.activate(after_tag=tag).getId() context.activate(after_tag=tag).getId()
...@@ -627,9 +627,13 @@ class TestSlaposCrmUpdateSupportRequestState(SlapOSTestCaseMixinWithAbort): ...@@ -627,9 +627,13 @@ class TestSlaposCrmUpdateSupportRequestState(SlapOSTestCaseMixinWithAbort):
def _makeSupportRequest(self): def _makeSupportRequest(self):
person = self.portal.person_module.template_member\ person = self.portal.person_module.template_member\
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
"""
support_request = self.portal.restrictedTraverse( support_request = self.portal.restrictedTraverse(
self.portal.portal_preferences.getPreferredSupportRequestTemplate()).\ self.portal.portal_preferences.getPreferredSupportRequestTemplate()).\
Base_createCloneDocument(batch_mode=1) Base_createCloneDocument(batch_mode=1)"""
support_request = self.portal.support_request_module.newContent(
portal_type="Support Request"
)
support_request.validate() support_request.validate()
new_id = self.generateNewId() new_id = self.generateNewId()
support_request.edit( support_request.edit(
...@@ -657,7 +661,7 @@ class TestSlaposCrmUpdateSupportRequestState(SlapOSTestCaseMixinWithAbort): ...@@ -657,7 +661,7 @@ class TestSlaposCrmUpdateSupportRequestState(SlapOSTestCaseMixinWithAbort):
return instance_tree return instance_tree
def test_updateSupportRequestState_monitoring(self): def test_SupportRequest_updateMonitoringState_alarm_monitoring(self):
support_request = self._makeSupportRequest() support_request = self._makeSupportRequest()
support_request.setResource("service_module/slapos_crm_monitoring") support_request.setResource("service_module/slapos_crm_monitoring")
hs = self._makeInstanceTree() hs = self._makeInstanceTree()
...@@ -667,7 +671,7 @@ class TestSlaposCrmUpdateSupportRequestState(SlapOSTestCaseMixinWithAbort): ...@@ -667,7 +671,7 @@ class TestSlaposCrmUpdateSupportRequestState(SlapOSTestCaseMixinWithAbort):
slapos_crm_update_support_request_state slapos_crm_update_support_request_state
self._test_alarm(alarm, support_request, "SupportRequest_updateMonitoringState") self._test_alarm(alarm, support_request, "SupportRequest_updateMonitoringState")
def test_updateSupportRequestState_not_monitoring(self): def test_SupportRequest_updateMonitoringState_alarm_notResource(self):
support_request = self._makeSupportRequest() support_request = self._makeSupportRequest()
hs = self._makeInstanceTree() hs = self._makeInstanceTree()
support_request.setAggregateValue(hs) support_request.setAggregateValue(hs)
...@@ -676,6 +680,25 @@ class TestSlaposCrmUpdateSupportRequestState(SlapOSTestCaseMixinWithAbort): ...@@ -676,6 +680,25 @@ class TestSlaposCrmUpdateSupportRequestState(SlapOSTestCaseMixinWithAbort):
slapos_crm_update_support_request_state slapos_crm_update_support_request_state
self._test_alarm_not_visited(alarm, support_request, "SupportRequest_updateMonitoringState") self._test_alarm_not_visited(alarm, support_request, "SupportRequest_updateMonitoringState")
def test_SupportRequest_updateMonitoringState_alarm_notValidated(self):
support_request = self._makeSupportRequest()
support_request.setResource("service_module/slapos_crm_monitoring")
support_request.invalidate()
hs = self._makeInstanceTree()
support_request.setAggregateValue(hs)
self.tic()
alarm = self.portal.portal_alarms.\
slapos_crm_update_support_request_state
self._test_alarm_not_visited(alarm, support_request, "SupportRequest_updateMonitoringState")
def test_SupportRequest_updateMonitoringState_alarm_noInstanceTree(self):
support_request = self._makeSupportRequest()
support_request.setResource("service_module/slapos_crm_monitoring")
self.tic()
alarm = self.portal.portal_alarms.\
slapos_crm_update_support_request_state
self._test_alarm_not_visited(alarm, support_request, "SupportRequest_updateMonitoringState")
class TestSlaposCrmSendPendingTicket_reminder(SlapOSTestCaseMixinWithAbort): class TestSlaposCrmSendPendingTicket_reminder(SlapOSTestCaseMixinWithAbort):
......
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