[Erp5-report] r19157 - /erp5/trunk/products/ERP5/tests/testNotificationTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Feb 8 10:54:31 CET 2008


Author: romain
Date: Fri Feb  8 10:54:30 2008
New Revision: 19157

URL: http://svn.erp5.org?rev=19157&view=rev
Log:
Check that recipient can be a Person object

Modified:
    erp5/trunk/products/ERP5/tests/testNotificationTool.py

Modified: erp5/trunk/products/ERP5/tests/testNotificationTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testNotificationTool.py?rev=19157&r1=19156&r2=19157&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testNotificationTool.py (original)
+++ erp5/trunk/products/ERP5/tests/testNotificationTool.py Fri Feb  8 10:54:30 2008
@@ -436,6 +436,41 @@
       recipient='UnknowUser', subject='Subject', message='Message'
     )
 
+  def stepCheckPersonNotification(self, sequence=None, 
+                                  sequence_list=None, **kw):
+    """
+    Check that notification is send when recipient is a Person
+    """
+    person = self.portal.portal_catalog(reference='userA')[0]
+    self.portal.portal_notifications.sendMessage(
+        recipient=person.getObject(), subject='Subject', message='Message')
+    last_message = self.portal.MailHost._last_message
+    self.assertNotEquals((), last_message)
+    mfrom, mto, messageText = last_message
+    self.assertEquals('site at example.invalid', mfrom)
+    self.assertEquals(['userA at example.invalid'], mto)
+    # Check Message
+    mail_dict = decode_email(messageText)
+    self.assertEquals(mail_dict['headers']['subject'], 'Subject')
+    self.assertEquals(mail_dict['body'], 'Message')
+    self.assertSameSet([], mail_dict['attachment_list'])
+
+  def test_10_PersonNotification(self, quiet=quiet, run=run_all_test):
+    if not run: return
+    if not quiet:
+      message = 'Test Person recipient'
+      ZopeTestCase._print('\n%s ' % message)
+      LOG('Testing... ', 0, message)
+
+    sequence_list = SequenceList()
+    sequence_string = '\
+        AddUserA \
+        Tic \
+        CheckPersonNotification\
+        '
+    sequence_list.addSequenceString(sequence_string)
+    sequence_list.play(self, quiet=quiet)
+
 def test_suite():
   suite = unittest.TestSuite()
   suite.addTest(unittest.makeSuite(TestNotificationTool))




More information about the Erp5-report mailing list