diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-07-31 13:11:53 +0200 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-11 17:00:31 +0200 |
commit | a7c84d6faf5ddd7866ce4c0508e03c7c3779eaca (patch) | |
tree | 0a1716ef830a64480f0ac8b8b8446294bfdd2835 /service | |
parent | 12636acfa193fb6871367771582f43a95611bfba (diff) |
Added mail store to mail service.
Diffstat (limited to 'service')
-rw-r--r-- | service/pixelated/adapter/services/mail_service.py | 3 | ||||
-rw-r--r-- | service/pixelated/config/services.py | 1 | ||||
-rw-r--r-- | service/test/support/integration/app_test_client.py | 9 | ||||
-rw-r--r-- | service/test/unit/adapter/test_mail_service.py | 3 |
4 files changed, 11 insertions, 5 deletions
diff --git a/service/pixelated/adapter/services/mail_service.py b/service/pixelated/adapter/services/mail_service.py index da1b1bea..23cbc5f7 100644 --- a/service/pixelated/adapter/services/mail_service.py +++ b/service/pixelated/adapter/services/mail_service.py @@ -20,8 +20,9 @@ from pixelated.adapter.services.tag_service import extract_reserved_tags class MailService(object): - def __init__(self, mailboxes, mail_sender, soledad_querier, search_engine): + def __init__(self, mailboxes, mail_sender, mail_store, soledad_querier, search_engine): self.mailboxes = mailboxes + self.mail_store = mail_store self.querier = soledad_querier self.search_engine = search_engine self.mail_sender = mail_sender diff --git a/service/pixelated/config/services.py b/service/pixelated/config/services.py index c20db10d..2b739acd 100644 --- a/service/pixelated/config/services.py +++ b/service/pixelated/config/services.py @@ -69,6 +69,7 @@ class Services(object): defer.returnValue(MailService( pixelated_mailboxes, pixelated_mail_sender, + leap_session.mail_store, soledad_querier, search_engine)) diff --git a/service/test/support/integration/app_test_client.py b/service/test/support/integration/app_test_client.py index c6cd9936..76b75920 100644 --- a/service/test/support/integration/app_test_client.py +++ b/service/test/support/integration/app_test_client.py @@ -31,6 +31,7 @@ from twisted.internet import reactor, defer from twisted.internet.defer import succeed from twisted.web.resource import getChildForRequest from twisted.web.server import Site +from pixelated.adapter.mailstore import LeapMailStore from pixelated.adapter.model.mail import PixelatedMail from pixelated.adapter.search import SearchEngine @@ -64,6 +65,8 @@ class AppTestClient(object): self.soledad = yield initialize_soledad(tempdir=soledad_test_folder) + self.mail_store = LeapMailStore(self.soledad) + self.soledad_querier = self._create_soledad_querier(self.soledad, self.INDEX_KEY) self.keymanager = mock() @@ -76,7 +79,7 @@ class AppTestClient(object): self.mailboxes = Mailboxes(self.account, self.soledad_querier, self.search_engine) self.draft_service = DraftService(self.mailboxes) - self.mail_service = self._create_mail_service(self.mailboxes, self.mail_sender, self.soledad_querier, self.search_engine) + self.mail_service = self._create_mail_service(self.mailboxes, self.mail_sender, self.mail_store, self.soledad_querier, self.search_engine) mails = yield self.mail_service.all_mails() self.search_engine.index_mails(mails) @@ -168,8 +171,8 @@ class AppTestClient(object): mail_sender.sendmail.side_effect = lambda mail: succeed(mail) return mail_sender - def _create_mail_service(self, mailboxes, mail_sender, soledad_querier, search_engine): - mail_service = MailService(mailboxes, mail_sender, soledad_querier, search_engine) + def _create_mail_service(self, mailboxes, mail_sender, mail_store, soledad_querier, search_engine): + mail_service = MailService(mailboxes, mail_sender, mail_store, soledad_querier, search_engine) return mail_service def _generate_soledad_test_folder_name(self, soledad_test_folder='/tmp/soledad-test/test'): diff --git a/service/test/unit/adapter/test_mail_service.py b/service/test/unit/adapter/test_mail_service.py index 4ee99d3a..1f88ca8d 100644 --- a/service/test/unit/adapter/test_mail_service.py +++ b/service/test/unit/adapter/test_mail_service.py @@ -26,6 +26,7 @@ class TestMailService(unittest.TestCase): def setUp(self): self.drafts = mock() self.querier = mock() + self.mail_store = mock() self.mailboxes = mock() self.mailboxes.drafts = defer.succeed(self.drafts) @@ -35,7 +36,7 @@ class TestMailService(unittest.TestCase): self.mail_sender = mock() self.search_engine = mock() - self.mail_service = MailService(self.mailboxes, self.mail_sender, self.querier, self.search_engine) + self.mail_service = MailService(self.mailboxes, self.mail_sender, self.mail_store, self.querier, self.search_engine) def tearDown(self): unstub() |