summaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2018-06-20 13:11:28 +0000
committerAleksander Machniak <machniak@kolabsys.com>2018-06-20 14:34:58 +0000
commit442f0e8f674677280b748386b2d5640058684e3d (patch)
tree204df1922ef914aa9112b48fb36ba1097c7d4b53 /tests/unit
parent90d2d23b4c21cf9b39582add9c8a6de9d91c3a15 (diff)
downloadpykolab-442f0e8f674677280b748386b2d5640058684e3d.tar.gz
Fix mocking sendmail operations
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test-011-wallace_resources.py3
-rw-r--r--tests/unit/test-012-wallace_invitationpolicy.py4
2 files changed, 4 insertions, 3 deletions
diff --git a/tests/unit/test-011-wallace_resources.py b/tests/unit/test-011-wallace_resources.py
index 73fba5d..35d85a0 100644
--- a/tests/unit/test-011-wallace_resources.py
+++ b/tests/unit/test-011-wallace_resources.py
@@ -109,7 +109,7 @@ class TestWallaceResources(unittest.TestCase):
import smtplib
self.patch(smtplib.SMTP, "__init__", self._mock_smtp_init)
self.patch(smtplib.SMTP, "quit", self._mock_nop)
- self.patch(smtplib.SMTP, "connect", self._mock_nop)
+ self.patch(smtplib.SMTP, "connect", self._mock_smtp_init)
self.patch(smtplib.SMTP, "sendmail", self._mock_smtp_sendmail)
self.smtplog = []
@@ -140,6 +140,7 @@ class TestWallaceResources(unittest.TestCase):
def _mock_smtp_sendmail(self, from_addr, to_addr, message, mail_options=None, rcpt_options=None):
self.smtplog.append((from_addr, to_addr, message))
+ return []
def _get_ics_part(self, message):
ics_part = None
diff --git a/tests/unit/test-012-wallace_invitationpolicy.py b/tests/unit/test-012-wallace_invitationpolicy.py
index 2bec175..e1adb4f 100644
--- a/tests/unit/test-012-wallace_invitationpolicy.py
+++ b/tests/unit/test-012-wallace_invitationpolicy.py
@@ -85,7 +85,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
import smtplib
self.patch(smtplib.SMTP, "__init__", self._mock_smtp_init)
self.patch(smtplib.SMTP, "quit", self._mock_nop)
- self.patch(smtplib.SMTP, "connect", self._mock_nop)
+ self.patch(smtplib.SMTP, "connect", self._mock_smtp_init)
self.patch(smtplib.SMTP, "sendmail", self._mock_smtp_sendmail)
self.smtplog = []
@@ -109,7 +109,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
def _mock_smtp_sendmail(self, from_addr, to_addr, message, mail_options=None, rcpt_options=None):
self.smtplog.append((from_addr, to_addr, message))
- return True
+ return []
def test_001_itip_events_from_message(self):
itips = pykolab.itip.events_from_message(message_from_string(itip_multipart))