Commit c71df6a0 authored by Jérome Perrin's avatar Jérome Perrin

event path: check the resource of created events

parent efddc268
...@@ -455,10 +455,12 @@ class TestCRM(BaseTestCRM): ...@@ -455,10 +455,12 @@ class TestCRM(BaseTestCRM):
mapping_method_id = "NotificationMessage_getSubstitutionMappingDictFromEvent" mapping_method_id = "NotificationMessage_getSubstitutionMappingDictFromEvent"
portal = self.portal portal = self.portal
notification_message_reference = 'campaign-Event.Path' notification_message_reference = 'campaign-Event.Path'
service = portal.service_module.newContent(portal_type='Service')
resource = portal.notification_message_module.newContent( resource = portal.notification_message_module.newContent(
reference=notification_message_reference, reference=notification_message_reference,
content_type="text/html", content_type="text/html",
portal_type="Notification Message", portal_type="Notification Message",
specialise_value=service,
text_content_substitution_mapping_method_id=mapping_method_id, text_content_substitution_mapping_method_id=mapping_method_id,
text_content="Hello ${destination_title}") text_content="Hello ${destination_title}")
resource.validate() resource.validate()
...@@ -490,7 +492,8 @@ class TestCRM(BaseTestCRM): ...@@ -490,7 +492,8 @@ class TestCRM(BaseTestCRM):
self.tic() self.tic()
campaign.Ticket_createEventFromDefaultEventPath() campaign.Ticket_createEventFromDefaultEventPath()
self.tic() self.tic()
event_list = campaign.getFollowUpRelatedValueList(portal_type='NOT Mail Message') event_list = [event for event in campaign.getFollowUpRelatedValueList()
if event.getPortalType() != 'Mail Message']
self.assertEquals(event_list, []) self.assertEquals(event_list, [])
event_list = campaign.getFollowUpRelatedValueList(portal_type='Mail Message') event_list = campaign.getFollowUpRelatedValueList(portal_type='Mail Message')
self.assertNotEquals(event_list, []) self.assertNotEquals(event_list, [])
...@@ -499,6 +502,7 @@ class TestCRM(BaseTestCRM): ...@@ -499,6 +502,7 @@ class TestCRM(BaseTestCRM):
mail_message = event_list[0] mail_message = event_list[0]
self.assertEquals(sender.getRelativeUrl(), mail_message.getSource()) self.assertEquals(sender.getRelativeUrl(), mail_message.getSource())
self.assertEquals(mail_message.getTextContent(), "Hello %s\n" % first_user.getTitle()) self.assertEquals(mail_message.getTextContent(), "Hello %s\n" % first_user.getTitle())
self.assertEquals(mail_message.getResourceValue(), service)
campaign = portal.campaign_module.newContent(portal_type="Campaign", campaign = portal.campaign_module.newContent(portal_type="Campaign",
default_event_path_event_portal_type="Visit", default_event_path_event_portal_type="Visit",
...@@ -508,13 +512,18 @@ class TestCRM(BaseTestCRM): ...@@ -508,13 +512,18 @@ class TestCRM(BaseTestCRM):
self.tic() self.tic()
campaign.Ticket_createEventFromDefaultEventPath() campaign.Ticket_createEventFromDefaultEventPath()
self.tic() self.tic()
event_list = campaign.getFollowUpRelatedValueList(portal_type='NOT Visit') event_list = [event for event in campaign.getFollowUpRelatedValueList()
if event.getPortalType() != 'Visit']
self.assertEquals([], event_list) self.assertEquals([], event_list)
event_list = campaign.getFollowUpRelatedValueList(portal_type='Visit') event_list = campaign.getFollowUpRelatedValueList(portal_type='Visit')
self.assertNotEquals([], event_list) self.assertNotEquals([], event_list)
destination_uid_list = map(lambda x: x.getDestinationUid(), event_list) destination_uid_list = map(lambda x: x.getDestinationUid(), event_list)
self.assertEquals([organisation.getUid()], destination_uid_list) self.assertEquals([organisation.getUid()], destination_uid_list)
resource_value_list = map(lambda x: x.getResourceValue(), event_list)
self.assertEquals([service], resource_value_list)
class TestCRMMailIngestion(BaseTestCRM): class TestCRMMailIngestion(BaseTestCRM):
"""Test Mail Ingestion for standalone CRM. """Test Mail Ingestion for standalone CRM.
""" """
......
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