[Erp5-report] r10093 - /erp5/trunk/products/ERP5Type/tests/utils.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Sep 18 14:35:49 CEST 2006
Author: jerome
Date: Mon Sep 18 14:35:46 2006
New Revision: 10093
URL: http://svn.erp5.org?rev=10093&view=rev
Log:
added a DummyMailhost object
Modified:
erp5/trunk/products/ERP5Type/tests/utils.py
Modified: erp5/trunk/products/ERP5Type/tests/utils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/utils.py?rev=10093&r1=10092&r2=10093&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/utils.py (original)
+++ erp5/trunk/products/ERP5Type/tests/utils.py Mon Sep 18 14:35:46 2006
@@ -26,8 +26,24 @@
#
##############################################################################
-"""Utility functions for unit testing
+"""Utility functions and classes for unit testing
"""
+
+from Products.MailHost.MailHost import MailHost
+
+class DummyMailHost(MailHost):
+ """Dummy Mail Host that doesn't really send messages and keep a copy in
+ _last_message attrbute.
+ To use it, you have to replace existing mailhost in afterSetUp:
+
+ if 'MailHost' in portal.objectIds():
+ portal.manage_delObjects(['MailHost'])
+ portal._setObject('MailHost', DummyMailHost('MailHost'))
+ """
+ _last_message = ()
+ def _send( self, mfrom, mto, messageText ):
+ """Record message in _last_message."""
+ self._last_message = (mfrom, mto, messageText)
def createZODBPythonScript(container, script_id, script_params,
script_content):
More information about the Erp5-report
mailing list