From 5c3468304f13fa0fe279a6e04fb90432d6737345 Mon Sep 17 00:00:00 2001 From: Folker Bernitt Date: Tue, 3 Nov 2015 16:34:52 +0100 Subject: Rename MailSender to LocalSmtpMailSender - Issue #499 --- service/pixelated/adapter/services/mail_sender.py | 2 +- service/pixelated/config/services.py | 4 ++-- service/test/unit/adapter/services/test_mail_sender.py | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/service/pixelated/adapter/services/mail_sender.py b/service/pixelated/adapter/services/mail_sender.py index 262a6e18..9c3ea3bb 100644 --- a/service/pixelated/adapter/services/mail_sender.py +++ b/service/pixelated/adapter/services/mail_sender.py @@ -27,7 +27,7 @@ class SMTPDownException(Exception): Exception.__init__(self, "Couldn't send mail now, try again later.") -class MailSender(object): +class LocalSmtpMailSender(object): def __init__(self, account_email_address, smtp): self.smtp = smtp diff --git a/service/pixelated/config/services.py b/service/pixelated/config/services.py index 41a357dc..23fd01d8 100644 --- a/service/pixelated/config/services.py +++ b/service/pixelated/config/services.py @@ -1,7 +1,7 @@ from pixelated.adapter.mailstore.searchable_mailstore import SearchableMailStore from pixelated.adapter.services.mail_service import MailService from pixelated.adapter.model.mail import InputMail -from pixelated.adapter.services.mail_sender import MailSender +from pixelated.adapter.services.mail_sender import LocalSmtpMailSender from pixelated.adapter.search import SearchEngine from pixelated.adapter.services.draft_service import DraftService from pixelated.adapter.listeners.mailbox_indexer_listener import listen_all_mailboxes @@ -57,7 +57,7 @@ class Services(object): def setup_mail_service(self, leap_session, search_engine): # if False: FIXME # yield pixelated_mailboxes.add_welcome_mail_for_fresh_user() - pixelated_mail_sender = MailSender( + pixelated_mail_sender = LocalSmtpMailSender( leap_session.account_email(), leap_session.smtp) return MailService( diff --git a/service/test/unit/adapter/services/test_mail_sender.py b/service/test/unit/adapter/services/test_mail_sender.py index 421a5f6d..7806c92a 100644 --- a/service/test/unit/adapter/services/test_mail_sender.py +++ b/service/test/unit/adapter/services/test_mail_sender.py @@ -16,14 +16,14 @@ from twisted.trial import unittest from mockito import mock, when, verify, any, unstub -from pixelated.adapter.services.mail_sender import MailSender, SMTPDownException +from pixelated.adapter.services.mail_sender import LocalSmtpMailSender, SMTPDownException from pixelated.adapter.model.mail import InputMail from test.support.test_helper import mail_dict from twisted.internet import reactor from twisted.internet.defer import Deferred -class MailSenderTest(unittest.TestCase): +class LocalSmtpMailSenderTest(unittest.TestCase): def setUp(self): self.smtp = mock() self.smtp.local_smtp_port_number = 4650 @@ -32,7 +32,7 @@ class MailSenderTest(unittest.TestCase): def test_sendmail(self): when(reactor).connectTCP('localhost', 4650, any()).thenReturn(None) input_mail = InputMail.from_dict(mail_dict()) - mail_sender = MailSender('someone@somedomain.tld', self.smtp) + mail_sender = LocalSmtpMailSender('someone@somedomain.tld', self.smtp) return self._succeed(mail_sender.sendmail(input_mail)) @@ -44,7 +44,7 @@ class MailSenderTest(unittest.TestCase): input_mail = InputMail.from_dict(mail_dict()) - mail_sender = MailSender('someone@somedomain.tld', self.smtp) + mail_sender = LocalSmtpMailSender('someone@somedomain.tld', self.smtp) sent_deferred = mail_sender.sendmail(input_mail) @@ -55,7 +55,7 @@ class MailSenderTest(unittest.TestCase): def test_senmail_returns_deffered(self): when(reactor).connectTCP('localhost', 4650, any()).thenReturn(None) input_mail = InputMail.from_dict(mail_dict()) - mail_sender = MailSender('someone@somedomain.tld', self.smtp) + mail_sender = LocalSmtpMailSender('someone@somedomain.tld', self.smtp) deferred = mail_sender.sendmail(input_mail) @@ -66,7 +66,7 @@ class MailSenderTest(unittest.TestCase): def test_doesnt_send_mail_if_smtp_is_not_running(self): self.smtp.ensure_running = lambda: False - mail_sender = MailSender('someone@somedomain.tld', self.smtp) + mail_sender = LocalSmtpMailSender('someone@somedomain.tld', self.smtp) deferred = mail_sender.sendmail({}) -- cgit v1.2.3