Skip to content

Commit f7eefe8

Browse files
committed
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
1 parent db3c4d4 commit f7eefe8

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

ietf/utils/mail.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ def send_mail_mime(request, to, frm, subject, msg, cc=None, extra=None, toUser=N
184184
copy_to = "ietf.tracker.archive+%s@gmail.com" % settings.SERVER_MODE
185185
if bcc:
186186
msg['X-Tracker-Bcc']=bcc
187-
copy_email(msg, copy_to)
187+
if not test_mode: # if we're running automated tests, this copy is just annoying
188+
copy_email(msg, copy_to)
188189

189190
def send_mail_preformatted(request, preformatted):
190191
"""Parse preformatted string containing mail with From:, To:, ...,

ietf/utils/test_runner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,6 @@ def run_tests(*args, **kwargs):
9090
raise EnvironmentError("Refusing to run tests on core3")
9191
import ietf.utils.mail
9292
ietf.utils.mail.send_smtp = test_send_smtp
93+
ietf.utils.mail.test_mode = True
9394
run_tests_1(*args, **kwargs)
9495

0 commit comments

Comments
 (0)