Commit bd4001bb authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: fix SupportRequest_updateMonitoringHostingSubscriptionState and add test.

parent cb2515a5
...@@ -4,7 +4,7 @@ import json ...@@ -4,7 +4,7 @@ import json
from Products.ERP5Type.DateUtils import addToDate from Products.ERP5Type.DateUtils import addToDate
portal = context.getPortalObject() portal = context.getPortalObject()
document = context.getSourceProjectValue() document = context.getAggregateValue()
if document is None: if document is None:
return return
...@@ -37,8 +37,7 @@ if not has_error: ...@@ -37,8 +37,7 @@ if not has_error:
return return
# Send Notification message # Send Notification message
message = """ Suspending this ticket as the problem is not present anymore. message = """ Suspending this ticket as the problem is not present anymore. """
"""
notification_reference = "slapos-crm-support-request-suspend-hs-notification" notification_reference = "slapos-crm-support-request-suspend-hs-notification"
notification_message = portal.portal_notifications.getDocumentValue( notification_message = portal.portal_notifications.getDocumentValue(
......
...@@ -8,7 +8,6 @@ from functools import wraps ...@@ -8,7 +8,6 @@ from functools import wraps
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
import difflib import difflib
import json import json
from unittest import skip
def simulate(script_id, params_string, code_string): def simulate(script_id, params_string, code_string):
def upperWrap(f): def upperWrap(f):
...@@ -3634,7 +3633,6 @@ class TestSupportRequestUpdateMonitoringState(testSlapOSMixin): ...@@ -3634,7 +3633,6 @@ class TestSupportRequestUpdateMonitoringState(testSlapOSMixin):
support_request.SupportRequest_updateMonitoringComputerState()) support_request.SupportRequest_updateMonitoringComputerState())
self.assertEquals(support_request.getSimulationState(), "suspended") self.assertEquals(support_request.getSimulationState(), "suspended")
@skip("Missing to finish")
@simulate('SupportRequest_trySendNotificationMessage', @simulate('SupportRequest_trySendNotificationMessage',
"message_title, message, source_relative_url", "message_title, message, source_relative_url",
'return "Visited by SupportRequest_trySendNotificationMessage '\ 'return "Visited by SupportRequest_trySendNotificationMessage '\
...@@ -3652,8 +3650,18 @@ class TestSupportRequestUpdateMonitoringState(testSlapOSMixin): ...@@ -3652,8 +3650,18 @@ class TestSupportRequestUpdateMonitoringState(testSlapOSMixin):
support_request.SupportRequest_updateMonitoringHostingSubscriptionState()) support_request.SupportRequest_updateMonitoringHostingSubscriptionState())
support_request.setAggregateValue(self._makeHostingSubscription()) support_request.setAggregateValue(self._makeHostingSubscription())
self.assertEquals(None,
support_request.SupportRequest_updateMonitoringHostingSubscriptionState())
support_request.setDestinationDecisionValue(self._makePerson()) support_request.setDestinationDecisionValue(self._makePerson())
raise NotImplementedError("Not implemented yet")
self.assertEquals("Visited by SupportRequest_trySendNotificationMessage Suspending this ticket as the problem is not present anymore Suspending this ticket as the problem is not present anymore. %s" % \
support_request.getDestinationDecision(),
support_request.SupportRequest_updateMonitoringHostingSubscriptionState())
self.assertEquals("suspended",
support_request.getSimulationState())
@simulate('SupportRequest_trySendNotificationMessage', @simulate('SupportRequest_trySendNotificationMessage',
"message_title, message, source_relative_url", "message_title, message, source_relative_url",
...@@ -3686,3 +3694,4 @@ class TestSupportRequestUpdateMonitoringState(testSlapOSMixin): ...@@ -3686,3 +3694,4 @@ class TestSupportRequestUpdateMonitoringState(testSlapOSMixin):
self.assertEquals("invalidated", self.assertEquals("invalidated",
support_request.getSimulationState()) support_request.getSimulationState())
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