From 9e07d9c126bbc68bf73744191480591f092d1eb4 Mon Sep 17 00:00:00 2001
From: Yusei Tahara <yusei@nexedi.com>
Date: Mon, 2 Mar 2009 07:51:39 +0000
Subject: [PATCH] Check if From header has multiple addresses and some of them
 are not written like <user@example.com>.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25762 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testCRM.py                  | 12 ++++++++++--
 product/ERP5/tests/test_data/crm_emails/simple |  2 +-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/product/ERP5/tests/testCRM.py b/product/ERP5/tests/testCRM.py
index f7dd43f258..38e7a75662 100644
--- a/product/ERP5/tests/testCRM.py
+++ b/product/ERP5/tests/testCRM.py
@@ -342,12 +342,17 @@ class TestCRMMailIngestion(ERP5TypeTestCase):
               title='Sender',
               subordination_value=customer_organisation,
               default_email_text='sender@customer.com')
-    # also create the recipient
+    # also create the recipients
     if 'me' not in portal.person_module.contentIds():
       portal.person_module.newContent(
               id='me',
               title='Me',
               default_email_text='me@erp5.org')
+    if 'he' not in portal.person_module.contentIds():
+      portal.person_module.newContent(
+              id='he',
+              title='He',
+              default_email_text='he@erp5.org')
 
     # make sure customers are available to catalog
     get_transaction().commit()
@@ -417,7 +422,10 @@ class TestCRMMailIngestion(ERP5TypeTestCase):
     event = self._ingestMail('simple')
     get_transaction().commit()
     self.tic()
-    self.assertEquals('person_module/me', event.getDestination())
+    destination_list = event.getDestinationList()
+    destination_list.sort()
+    self.assertEquals(['person_module/he', 'person_module/me'],
+                      destination_list)
 
   def test_follow_up(self):
     # follow up is found automatically, based on the content of the mail, and
diff --git a/product/ERP5/tests/test_data/crm_emails/simple b/product/ERP5/tests/test_data/crm_emails/simple
index 32afe7e467..c5612deacc 100644
--- a/product/ERP5/tests/test_data/crm_emails/simple
+++ b/product/ERP5/tests/test_data/crm_emails/simple
@@ -5,7 +5,7 @@ Message-ID: <4719FE4D.2070403@erp5.org>
 Date: Sat, 20 Oct 2007 15:10:37 +0200
 From: Sender <sender@customer.com>
 User-Agent: Thunderbird 2.0.0.6 (X11/20070728)
-To: Me <me@erp5.org>
+To: Me <me@erp5.org>, he@erp5.org,she@erp5.org
 Subject: Simple Mail Test
 Content-Type: text/plain; charset=UTF-8; format=flowed
 Content-Transfer-Encoding: 7bit
-- 
2.30.9