[Erp5-report] r32079 leonardo - /erp5/trunk/products/ERP5/tests/testInvoice.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jan 28 20:42:38 CET 2010


Author: leonardo
Date: Thu Jan 28 20:42:37 2010
New Revision: 32079

URL: http://svn.erp5.org?rev=32079&view=rev
Log:
capture outgoing emails

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

Modified: erp5/trunk/products/ERP5/tests/testInvoice.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testInvoice.py?rev=32079&r1=32078&r2=32079&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testInvoice.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testInvoice.py [utf8] Thu Jan 28 20:42:37 2010
@@ -33,7 +33,7 @@
 
 import transaction
 from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
-from Products.ERP5Type.tests.utils import FileUpload
+from Products.ERP5Type.tests.utils import FileUpload, DummyMailHost
 from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
 from Products.ERP5OOo.OOoUtils import OOoParser
 from AccessControl.SecurityManagement import newSecurityManager
@@ -57,6 +57,7 @@
   cpt_incoterm = 'cpt'
   unit_piece_quantity_unit = 'unit/piece'
   mass_quantity_unit = 'mass/kg'
+  oldMailhost = None
 
   # (account_id, account_gap, account_type)
   account_definition_list = (
@@ -119,10 +120,18 @@
     self.createCategories()
     self.validateRules()
     self.login()
+    self.oldMailHost = getattr(self.portal, 'MailHost', None)
+    if self.oldMailHost is not None:
+      self.portal.manage_delObjects(['MailHost'])
+      self.portal._setObject('MailHost', DummyMailHost('MailHost'))
 
   def beforeTearDown(self):
     transaction.abort()
     self.tic()
+    # restore the original MailHost
+    if self.oldMailHost is not None:
+      self.portal.manage_delObjects(['MailHost'])
+      self.portal._setObject('MailHost', DummyMailHost('MailHost'))
     for folder in (self.portal.accounting_module,
                    self.portal.organisation_module,
                    self.portal.sale_order_module,




More information about the Erp5-report mailing list