Commit 11119d2d authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Set customer as source of notification

parent 9f8753a1
...@@ -675,7 +675,9 @@ class TestSlapOSComputeNode_notifyWrongAllocationScope(TestCRMSkinsMixin): ...@@ -675,7 +675,9 @@ class TestSlapOSComputeNode_notifyWrongAllocationScope(TestCRMSkinsMixin):
self.assertEqual(event.getTitle(), self.assertEqual(event.getTitle(),
'Allocation scope of %s changed to %s' % (compute_node.getReference(), 'open/personal')) 'Allocation scope of %s changed to %s' % (compute_node.getReference(), 'open/personal'))
self.assertIn(compute_node.getReference(), event.getTextContent()) self.assertIn(compute_node.getReference(), event.getTextContent())
self.assertEqual(event.getDestination(), person.getRelativeUrl()) self.assertEqual(event.getSource(), person.getRelativeUrl())
self.assertEqual(event.getDestination(), ticket.getSourceSection())
@simulate('ERP5Site_isSupportRequestCreationClosed', '*args, **kwargs','return 0') @simulate('ERP5Site_isSupportRequestCreationClosed', '*args, **kwargs','return 0')
@simulate('NotificationTool_getDocumentValue', @simulate('NotificationTool_getDocumentValue',
...@@ -705,7 +707,9 @@ class TestSlapOSComputeNode_notifyWrongAllocationScope(TestCRMSkinsMixin): ...@@ -705,7 +707,9 @@ class TestSlapOSComputeNode_notifyWrongAllocationScope(TestCRMSkinsMixin):
self.assertEqual(event.getTitle(), self.assertEqual(event.getTitle(),
'Allocation scope of %s changed to %s' % (compute_node.getReference(), 'open/personal')) 'Allocation scope of %s changed to %s' % (compute_node.getReference(), 'open/personal'))
self.assertIn(compute_node.getReference(), event.getTextContent()) self.assertIn(compute_node.getReference(), event.getTextContent())
self.assertEqual(event.getDestination(), person.getRelativeUrl()) self.assertEqual(event.getSource(), person.getRelativeUrl())
self.assertEqual(event.getDestination(), ticket.getSourceSection())
@simulate('ERP5Site_isSupportRequestCreationClosed', '*args, **kwargs','return 0') @simulate('ERP5Site_isSupportRequestCreationClosed', '*args, **kwargs','return 0')
@simulate('ComputeNode_hasContactedRecently', '*args, **kwargs','return False') @simulate('ComputeNode_hasContactedRecently', '*args, **kwargs','return False')
...@@ -737,7 +741,9 @@ class TestSlapOSComputeNode_notifyWrongAllocationScope(TestCRMSkinsMixin): ...@@ -737,7 +741,9 @@ class TestSlapOSComputeNode_notifyWrongAllocationScope(TestCRMSkinsMixin):
'Allocation scope of %s changed to %s' % \ 'Allocation scope of %s changed to %s' % \
(compute_node.getReference(), target_allocation_scope)) (compute_node.getReference(), target_allocation_scope))
self.assertIn(compute_node.getReference(), event.getTextContent()) self.assertIn(compute_node.getReference(), event.getTextContent())
self.assertEqual(event.getDestination(), person.getRelativeUrl()) self.assertEqual(event.getSource(), person.getRelativeUrl())
self.assertEqual(event.getDestination(), support_request.getSourceSection())
def test_ComputeNodeNormalAllocationScope_OpenPersonal(self): def test_ComputeNodeNormalAllocationScope_OpenPersonal(self):
compute_node = self._makeComputeNode(owner=self.makePerson(user=0))[0] compute_node = self._makeComputeNode(owner=self.makePerson(user=0))[0]
...@@ -1065,7 +1071,9 @@ class TestSlapOSComputeNode_CheckState(TestCRMSkinsMixin): ...@@ -1065,7 +1071,9 @@ class TestSlapOSComputeNode_CheckState(TestCRMSkinsMixin):
self.assertEqual(event.getTitle(), ticket.getTitle()) self.assertEqual(event.getTitle(), ticket.getTitle())
self.assertIn(compute_node.getReference(), event.getTextContent()) self.assertIn(compute_node.getReference(), event.getTextContent())
self.assertEqual(event.getDestination(), person.getRelativeUrl()) self.assertEqual(event.getSource(), person.getRelativeUrl())
self.assertEqual(event.getDestination(), ticket.getSourceSection())
@simulate('ERP5Site_isSupportRequestCreationClosed', '*args, **kwargs','return 0') @simulate('ERP5Site_isSupportRequestCreationClosed', '*args, **kwargs','return 0')
@simulate('NotificationTool_getDocumentValue', @simulate('NotificationTool_getDocumentValue',
...@@ -1092,7 +1100,8 @@ class TestSlapOSComputeNode_CheckState(TestCRMSkinsMixin): ...@@ -1092,7 +1100,8 @@ class TestSlapOSComputeNode_CheckState(TestCRMSkinsMixin):
self.assertEqual(event.getTitle(), ticket.getTitle()) self.assertEqual(event.getTitle(), ticket.getTitle())
self.assertIn(compute_node.getReference(), event.getTextContent()) self.assertIn(compute_node.getReference(), event.getTextContent())
self.assertEqual(event.getDestination(), person.getRelativeUrl()) self.assertEqual(event.getDestination(), ticket.getSourceSection())
self.assertEqual(event.getSource(), person.getRelativeUrl())
class TestSlapOSInstanceTree_createSupportRequestEvent(SlapOSTestCaseMixin): class TestSlapOSInstanceTree_createSupportRequestEvent(SlapOSTestCaseMixin):
...@@ -1158,7 +1167,8 @@ class TestSlapOSInstanceTree_createSupportRequestEvent(SlapOSTestCaseMixin): ...@@ -1158,7 +1167,8 @@ class TestSlapOSInstanceTree_createSupportRequestEvent(SlapOSTestCaseMixin):
self.assertEqual(event.getTitle(), ticket_title) self.assertEqual(event.getTitle(), ticket_title)
self.assertIn(instance_tree.getReference(), event.getTextContent()) self.assertIn(instance_tree.getReference(), event.getTextContent())
self.assertEqual(event.getDestination(), person.getRelativeUrl()) self.assertEqual(event.getSource(), person.getRelativeUrl())
self.assertEqual(event.getDestination(), ticket.getSourceSection())
ticket.suspend() ticket.suspend()
self.tic() self.tic()
...@@ -1576,7 +1586,8 @@ class TestSupportRequestUpdateMonitoringState(SlapOSTestCaseMixin): ...@@ -1576,7 +1586,8 @@ class TestSupportRequestUpdateMonitoringState(SlapOSTestCaseMixin):
event = event_list[0] event = event_list[0]
self.assertEqual(event.getTitle(), 'Instance Tree was destroyed was destroyed by the user') self.assertEqual(event.getTitle(), 'Instance Tree was destroyed was destroyed by the user')
self.assertEqual(event.getDestination(), support_request.getDestinationDecision()) self.assertEqual(event.getSource(), support_request.getDestinationDecision())
self.assertEqual(event.getDestination(), support_request.getSourceSection())
self.assertEqual("invalidated", self.assertEqual("invalidated",
support_request.getSimulationState()) support_request.getSimulationState())
......
...@@ -6,12 +6,6 @@ ...@@ -6,12 +6,6 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testSlapOSCRMSkins</string> </value> <value> <string>testSlapOSCRMSkins</string> </value>
...@@ -55,28 +49,13 @@ ...@@ -55,28 +49,13 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -89,7 +68,7 @@ ...@@ -89,7 +68,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -98,7 +77,7 @@ ...@@ -98,7 +77,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -162,9 +162,9 @@ class TestSlapOSCoreTicketSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -162,9 +162,9 @@ class TestSlapOSCoreTicketSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertEqual(self.support_request.getSimulationState(), self.assertEqual(self.support_request.getSimulationState(),
'validated') 'validated')
self.assertEqual(self.support_request.getDestinationDecision(), self.assertEqual(self.support_request.getSourceSection(),
event.getDestination()) event.getDestination())
self.assertEqual(person, event.getDestinationValue()) self.assertEqual(person, event.getSourceValue())
self.assertEqual("service_module/slapos_crm_information", self.assertEqual("service_module/slapos_crm_information",
event.getResource()) event.getResource())
...@@ -176,7 +176,9 @@ class TestSlapOSCoreTicketSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -176,7 +176,9 @@ class TestSlapOSCoreTicketSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertEqual(event.getContentType(), "text/html") self.assertEqual(event.getContentType(), "text/html")
self.assertEqual(event.getPortalType(), "Web Message") self.assertEqual(event.getPortalType(), "Web Message")
self.assertEqual(event.getSource(), self.assertEqual(event.getSource(),
self.support_request.getSource()) self.support_request.getDestinationDecision())
self.assertEqual(event.getDestination(),
self.support_request.getSourceSection())
# Retry now to see if doesn't create a new message # Retry now to see if doesn't create a new message
self.support_request.notify( self.support_request.notify(
......
...@@ -43,8 +43,8 @@ event.edit( ...@@ -43,8 +43,8 @@ event.edit(
text_content=message, text_content=message,
start_date = DateTime(), start_date = DateTime(),
resource = resource, resource = resource,
source=ticket.getSource(), source=ticket.getDestinationDecision(),
destination=ticket.getDestinationDecision(), destination=ticket.getSource(),
follow_up=ticket.getRelativeUrl(), follow_up=ticket.getRelativeUrl(),
) )
event.stop() event.stop()
......
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