How to start a server in test mode

Asked by Daniel Reis

I just found out that ir.mail.server prevents e-mail to be sent if the thread has a "testing" attribute:

def send_email(...):
        # Do not actually send emails in testing mode!
        if getattr(threading.currentThread(), 'testing', False):
            _logger.log(logging.TEST, "skip sending email in test mode")
            return message['Message-Id']

How do you start a server so that it has this attribute activated?

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Давид (kettor) said :
#1

Hello Daniel,

To start OpenERP with testing mode use below code.

prompt~$ openerp-server --log-level debug_rpc_answers --addons-path addons,web/addons

digg the --log-level parameter for testing purpose.

To ignore sending of smtp code, locate at file

/server/openerp/addons/base/ir/ir_mail_server.py
Line 457: smtp.sendmail(smtp_from, smtp_to_list, message.as_string())

I hope by digging ir_mail_server.py file you will resolve your testing.

Thanks,
Kettor.

Can you help with this problem?

Provide an answer of your own, or ask Daniel Reis for more information if necessary.

To post a message you must log in.