diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-11-04 10:11:19 +0100 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-11-04 12:02:53 +0100 |
commit | d79aa00e3c24c5bf5e5ed5ba5a9b976f93034362 (patch) | |
tree | 87a32a2e85d04b3bebc2ceb4aa56b447488940b6 /service/test/unit/adapter/services | |
parent | ffa355c46eda5d05f25890420218845ac3e53f71 (diff) |
Instantiate new MailSender in Services
- Issue #499
- Some smaller refactorings
- Extract smtp cert download to own class
Diffstat (limited to 'service/test/unit/adapter/services')
-rw-r--r-- | service/test/unit/adapter/services/test_mail_sender.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/service/test/unit/adapter/services/test_mail_sender.py b/service/test/unit/adapter/services/test_mail_sender.py index ca68bdc6..d8c33f17 100644 --- a/service/test/unit/adapter/services/test_mail_sender.py +++ b/service/test/unit/adapter/services/test_mail_sender.py @@ -19,6 +19,7 @@ from twisted.trial import unittest from mockito import mock, when, verify, any, unstub from pixelated.adapter.services.mail_sender import LocalSmtpMailSender, SMTPDownException, MailSender from pixelated.adapter.model.mail import InputMail +from pixelated.bitmask_libraries.smtp import LeapSMTPConfig from pixelated.support.functional import flatten from test.support.test_helper import mail_dict from twisted.internet import reactor, defer @@ -32,17 +33,19 @@ class MailSenderTest(unittest.TestCase): self._keymanager_mock = mock() self._remote_smtp_host = 'some.host.test' self._remote_smtp_port = 1234 + self._smtp_config = LeapSMTPConfig('someone@somedomain.tld', self._cert_path, self._remote_smtp_host, self._remote_smtp_port) def tearDown(self): unstub() + @defer.inlineCallbacks def test_iterates_over_recipients(self): - sender = MailSender('someone@somedomain.tld', self._keymanager_mock, self._cert_path, self._remote_smtp_host, self._remote_smtp_port) + sender = MailSender(self._smtp_config, self._keymanager_mock) input_mail = InputMail.from_dict(mail_dict()) when(OutgoingMail).send_message(any(), any()).thenAnswer(lambda: defer.succeed(None)) - sender.sendmail(input_mail) + yield sender.sendmail(input_mail) for recipient in flatten([input_mail.to, input_mail.cc, input_mail.bcc]): verify(OutgoingMail).send_message(any(), recipient) |