Commit 8dbf98d7 authored by Rafael Monnerat's avatar Rafael Monnerat

Added External Method for setup DummyMailHost at the instance. Updated...

Added External Method for setup DummyMailHost at the instance. Updated MailHost_reportMessageList to get as plan text all Mails that should be sent by the instance.

With this change, it can be possible replace MailHost into test instance or cloned instance for test propose, this will prevent flood Mail Boxes or Mailing list with activities failure messages which does not comes from production.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30446 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 15b109a6
##############################################################################
#
# Copyright (c) 2002-2009 Nexedi SA and Contributors. All Rights Reserved.
# Rafael Monnerat <rafael@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Products.ERP5Type.tests.utils import DummyMailHost
def setupDummyMailHost(self):
portal = self.getPortalObject()
# Replace MailHost by DummyMailHost
if 'MailHost' in portal.objectIds():
portal.manage_delObjects(['MailHost'])
portal._setObject('MailHost', DummyMailHost('MailHost'))
return True
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>setupDummyMailHost</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>MailHostUtils</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_setupDummyMailHost</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -61,7 +61,7 @@
the instance spam mailing lists during the \n
Functional Tests.\n
"""\n
if getattr("context.MailHost", "getMessageList", None) is None:\n
if getattr(context.MailHost, "getMessageList", None) is None:\n
return "ERROR: MailHost is not a DummyMailHost"\n
\n
for mail in context.MailHost.getMessageList():\n
......@@ -110,10 +110,10 @@ return printed\n
<string>_print_</string>
<string>_print</string>
<string>getattr</string>
<string>None</string>
<string>_getiter_</string>
<string>_getattr_</string>
<string>context</string>
<string>None</string>
<string>_getiter_</string>
<string>mail</string>
<string>part</string>
</tuple>
......
13
\ No newline at end of file
15
\ No newline at end of file
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