diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2014-10-08 18:06:28 +0200 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2014-10-09 18:24:41 +0200 |
commit | 85264c9ab3052dd844016d3ec44cb8af43dd5869 (patch) | |
tree | d6a5cb6511039407fdef40804c5338347b71c551 /service/test/support | |
parent | fb8782d3f66b1068153a9948a01864ee52e39b10 (diff) |
Added whoosh as search engine (issue #94).
Diffstat (limited to 'service/test/support')
-rw-r--r-- | service/test/support/integration_helper.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/service/test/support/integration_helper.py b/service/test/support/integration_helper.py index 616485ee..e776e3c3 100644 --- a/service/test/support/integration_helper.py +++ b/service/test/support/integration_helper.py @@ -21,8 +21,10 @@ import os from mock import Mock import shutil from pixelated.adapter.mail_service import MailService +from pixelated.adapter.search import SearchEngine from pixelated.adapter.tag_index import TagIndex from pixelated.adapter.tag_service import TagService +from pixelated.adapter.draft_service import DraftService import pixelated.user_agent from pixelated.adapter.pixelated_mail import PixelatedMail, InputMail from pixelated.adapter.pixelated_mailboxes import PixelatedMailBoxes @@ -121,13 +123,19 @@ class SoledadTestBase: PixelatedMail.from_email_address = self.mail_address self.app = pixelated.user_agent.app.test_client() self.account = FakeAccount() + self.pixelated_mailboxes = PixelatedMailBoxes(self.account) self.mail_sender = mock() self.tag_index = TagIndex(os.path.join(soledad_test_folder, 'tag_index')) self.tag_service = TagService(self.tag_index) - self.pixelated_mailboxes = PixelatedMailBoxes(self.account) + self.draft_service = DraftService(self.pixelated_mailboxes) self.mail_service = MailService(self.pixelated_mailboxes, self.mail_sender, self.tag_service) + self.search_engine = SearchEngine() + self.search_engine.index_mails(self.mail_service.all_mails()) pixelated.user_agent.mail_service = self.mail_service + pixelated.user_agent.draft_service = self.draft_service + pixelated.user_agent.tag_service = self.tag_service + pixelated.user_agent.search_engine = self.search_engine def get_mails_by_tag(self, tag): response = json.loads(self.app.get("/mails?q=tag:" + tag).data) @@ -151,6 +159,10 @@ class SoledadTestBase: def mark_as_read(self, mail_ident): self.app.post('/mail/' + mail_ident + '/read', content_type="application/json") + def add_mail_to_inbox(self, input_mail): + mail = self.pixelated_mailboxes.inbox().add(input_mail) + self.search_engine.index_mail(mail) + class ResponseMail: def __init__(self, mail_dict): |