From f7eefe8ee2ebcbbc61db32afa9a7f3b8bf3ee7fb Mon Sep 17 00:00:00 2001 From: Ole Laursen Date: Tue, 8 Nov 2011 11:48:57 +0000 Subject: [PATCH] Finally get the mail system during automated test to send the real message (i.e. pretend to do) instead of sending a copy, should make it a bit easier to write tests - Legacy-Id: 3595 --- ietf/utils/mail.py | 3 ++- ietf/utils/test_runner.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ietf/utils/mail.py b/ietf/utils/mail.py index af75cd835..e99071fb9 100644 --- a/ietf/utils/mail.py +++ b/ietf/utils/mail.py @@ -184,7 +184,8 @@ def send_mail_mime(request, to, frm, subject, msg, cc=None, extra=None, toUser=N copy_to = "ietf.tracker.archive+%s@gmail.com" % settings.SERVER_MODE if bcc: msg['X-Tracker-Bcc']=bcc - copy_email(msg, copy_to) + if not test_mode: # if we're running automated tests, this copy is just annoying + copy_email(msg, copy_to) def send_mail_preformatted(request, preformatted): """Parse preformatted string containing mail with From:, To:, ..., diff --git a/ietf/utils/test_runner.py b/ietf/utils/test_runner.py index 37b44d950..2d0cd430b 100644 --- a/ietf/utils/test_runner.py +++ b/ietf/utils/test_runner.py @@ -90,5 +90,6 @@ def run_tests(*args, **kwargs): raise EnvironmentError("Refusing to run tests on core3") import ietf.utils.mail ietf.utils.mail.send_smtp = test_send_smtp + ietf.utils.mail.test_mode = True run_tests_1(*args, **kwargs)