From 931362fac31421b9b2ee7cf2a15b4c44ae6dc636 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 28 Nov 2007 16:16:28 +0000
Subject: [PATCH] When an email is ingested, we try to find the related
 campaign, for now, just try that we don't blindly get the first campaign.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17880 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testCRM.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/product/ERP5/tests/testCRM.py b/product/ERP5/tests/testCRM.py
index 794c10ec27..b26b562053 100644
--- a/product/ERP5/tests/testCRM.py
+++ b/product/ERP5/tests/testCRM.py
@@ -52,6 +52,7 @@ class TestCRMMailIngestion(ERP5TypeTestCase):
       # set prefered file name regular expression
       pref = portal.portal_preferences.default_site_preference
       pref.setPreferredDocumentFileNameRegularExpression('.*')
+      pref.setPreferredDocumentReferenceRegularExpression('.*')
       pref.enable()
 
       # XXX do this in ERP5Site.py ?
@@ -139,6 +140,20 @@ class TestCRMMailIngestion(ERP5TypeTestCase):
     get_transaction().commit()
     self.tic()
     self.assertEquals('person_module/me', event.getDestination())
+
+  def test_follow_up(self):
+    # follow up is found automatically, based on the content of the mail, and
+    # what you defined in preference regexpr.
+    # But, we don't want it to associate with the first campaign simply
+    # because we searched against nothing
+    self.portal.campaign_module.newContent(portal_type='Campaign')
+    get_transaction().commit()
+    self.tic()
+    event = self._ingestMail('simple')
+    get_transaction().commit()
+    self.tic()
+    self.assertEquals(None, event.getFollowUp())
+ 
  
 ## TODO:
 ##  def test_forwarder_mail(self):
-- 
2.30.9