Commit 867d4fd1 authored by Yusei Tahara's avatar Yusei Tahara

Remove wrong argument.

Add a forwarded mail test.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20251 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 88cf4ff5
......@@ -348,42 +348,42 @@ class TestCRMMailIngestion(ERP5TypeTestCase):
message = email.message_from_string(self._readTestData('simple'))
message.replace_header('subject', 'Visit:Company A')
data = message.as_string()
document = self._ingestMail(self, data=data)
document = self._ingestMail(data=data)
self.assertEqual(document.portal_type, 'Visit')
self.assertEqual(document.getTitle(), 'Company A')
message = email.message_from_string(self._readTestData('simple'))
message.replace_header('subject', 'Fax:Company B')
data = message.as_string()
document = self._ingestMail(self, data=data)
document = self._ingestMail(data=data)
self.assertEqual(document.portal_type, 'Fax Message')
self.assertEqual(document.getTitle(), 'Company B')
message = email.message_from_string(self._readTestData('simple'))
message.replace_header('subject', 'TEST:Company B')
data = message.as_string()
document = self._ingestMail(self, data=data)
document = self._ingestMail(data=data)
self.assertEqual(document.portal_type, 'Mail Message')
self.assertEqual(document.getTitle(), 'TEST:Company B')
message = email.message_from_string(self._readTestData('simple'))
message.replace_header('subject', 'visit:Company A')
data = message.as_string()
document = self._ingestMail(self, data=data)
document = self._ingestMail(data=data)
self.assertEqual(document.portal_type, 'Visit')
self.assertEqual(document.getTitle(), 'Company A')
message = email.message_from_string(self._readTestData('simple'))
message.replace_header('subject', 'phone:Company B')
data = message.as_string()
document = self._ingestMail(self, data=data)
document = self._ingestMail(data=data)
self.assertEqual(document.portal_type, 'Phone Call')
self.assertEqual(document.getTitle(), 'Company B')
message = email.message_from_string(self._readTestData('simple'))
message.replace_header('subject', 'LETTER:Company C')
data = message.as_string()
document = self._ingestMail(self, data=data)
document = self._ingestMail(data=data)
self.assertEqual(document.portal_type, 'Letter')
self.assertEqual(document.getTitle(), 'Company C')
......@@ -391,7 +391,7 @@ class TestCRMMailIngestion(ERP5TypeTestCase):
body = message.get_payload()
message.set_payload('Visit:%s' % body)
data = message.as_string()
document = self._ingestMail(self, data=data)
document = self._ingestMail(data=data)
self.assertEqual(document.portal_type, 'Visit')
self.assertEqual(document.getTextContent(), body)
......@@ -399,14 +399,28 @@ class TestCRMMailIngestion(ERP5TypeTestCase):
body = message.get_payload()
message.set_payload('PHONE CALL:%s' % body)
data = message.as_string()
document = self._ingestMail(self, data=data)
document = self._ingestMail(data=data)
self.assertEqual(document.portal_type, 'Phone Call')
self.assertEqual(document.getTextContent(), body)
def test_forwarder_mail(self):
"""
Make sure that if ingested email is forwarded one, the sender of
original mail should be the sender of event and the sender of
forwarded mail should be the recipient of event.
"""
document = self._ingestMail(filename='forwarded')
get_transaction().commit()
self.tic()
self.assertEqual(document.getContentInformation().get('From'), 'Me <me@erp5.org>')
self.assertEqual(document.getContentInformation().get('To'), 'crm@erp5.org')
self.assertEqual(document.getSourceValue().getTitle(), 'Sender')
self.assertEqual(document.getDestinationValue().getTitle(), 'Me')
## TODO:
## def test_forwarder_mail(self):
## # if there is a forwarded email, import the forwarded email
## event = self._ingestMail('forwarded')
##
## def test_attachements(self):
## event = self._ingestMail('with_attachements')
......
Return-Path: <me@erp5.org>
X-Original-To: me@erp5.org
Delivered-To: me@erp5.org
Message-ID: <4719FE4D.2070403@erp5.org>
Date: Sat, 20 Oct 2007 16:10:37 +0200
From: Me <me@erp5.org>
User-Agent: Thunderbird 2.0.0.6 (X11/20070728)
To: crm@erp5.org
Subject: Fw:Simple Mail Test
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Hello,
Begin forwarded message:
Subject: Simple Mail Test
Date: Sat, 20 Oct 2007 15:10:37 +0200
From: Sender <sender@customer.com>
To: Me <me@erp5.org>
Hello,
Content of the mail.
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