From c1e3007aa6bd06d56f48d132188920b59fda0cf7 Mon Sep 17 00:00:00 2001 From: Adam Coddington Date: Tue, 4 Aug 2015 07:30:38 -0700 Subject: [PATCH] Prevent e-mails from being dispatched during tests. --- django_mailbox/tests/test_process_email.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/django_mailbox/tests/test_process_email.py b/django_mailbox/tests/test_process_email.py index 47632cd..3f9b36b 100644 --- a/django_mailbox/tests/test_process_email.py +++ b/django_mailbox/tests/test_process_email.py @@ -1,6 +1,7 @@ import os.path import sys +import mock import six from django_mailbox.models import Mailbox, Message @@ -213,13 +214,15 @@ class TestProcessEmail(EmailMessageTestCase): self.assertTrue(msg.outgoing) actual_from = 'username@example.com' - reply_email_object = EmailMessage('Test subject', # subject + reply_email_object = EmailMessage( + 'Test subject', # subject 'Test body', # body actual_from, # from ['mr.test32@mail.ru'], # to ) - reply_msg = msg.reply(reply_email_object) + with mock.patch.object(reply_email_object, 'send'): + reply_msg = msg.reply(reply_email_object) self.assertEqual(reply_msg.in_reply_to, msg)