Commit 2c3a9767 authored by Romain Courteaud's avatar Romain Courteaud

slapos_crm: test slapos_crm_update_support_request_state

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