diff options
author | Bruno Wagner & Victor Shyba <bwgpro+victor.shyba@gmail.com> | 2015-02-27 20:14:03 -0300 |
---|---|---|
committer | Pixpoa pairing <pixpoapairing@pixelated-project.org> | 2015-02-27 20:14:03 -0300 |
commit | b39dd32f852d8ee6ed088c0d576d239194ccf6e5 (patch) | |
tree | 7aad814340f6cafc7b2e5c86be4b4373503ee67f /service/test/unit | |
parent | b0084ec7184b2183d1ccabe1a0e017473e7a2892 (diff) |
Refactored out tag service and replaced mail normalization with built-in parseaddr
Also made some minor fixes based on pylint output
Diffstat (limited to 'service/test/unit')
-rw-r--r-- | service/test/unit/adapter/test_email_recepient_normalizer.py | 42 | ||||
-rw-r--r-- | service/test/unit/adapter/test_mail_service.py | 3 | ||||
-rw-r--r-- | service/test/unit/adapter/test_mailbox.py | 1 |
3 files changed, 1 insertions, 45 deletions
diff --git a/service/test/unit/adapter/test_email_recepient_normalizer.py b/service/test/unit/adapter/test_email_recepient_normalizer.py deleted file mode 100644 index 79d50273..00000000 --- a/service/test/unit/adapter/test_email_recepient_normalizer.py +++ /dev/null @@ -1,42 +0,0 @@ -# -# Copyright (c) 2014 ThoughtWorks, Inc. -# -# Pixelated is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Pixelated is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Pixelated. If not, see <http://www.gnu.org/licenses/>. -import unittest - -from pixelated.adapter.model.mail import PixelatedMail -from pixelated.adapter.services.mailbox import Mailbox -from pixelated.adapter.services.mail_sender import MailSender -from mockito import * -from test.support import test_helper - - -class PixelatedDuplicateEmailTest(unittest.TestCase): - def setUp(self): - self.mail_sender = MailSender(self, "random@gmail.com") - - def test_remove_duplicate_mail_recepients(self): - mail_list = ['simba@gmail.com', 'simba@gmail.com', 'fabio@gmail.com'] - normalized_recepients = self.mail_sender.recepients_normalizer(mail_list) - self.assertEquals(normalized_recepients, set(['simba@gmail.com', 'fabio@gmail.com'])) - - def test_get_email_addresses(self): - mail_list = ['simbarashe<simba@gmail.com>', 'vic@gmail.com', 'Fabio<fabio@gmail.com>', 'slick@gmail.com'] - selected_recepients = self.mail_sender.get_email_addresses(mail_list) - self.assertEquals(selected_recepients, set(['simba@gmail.com', 'vic@gmail.com', 'fabio@gmail.com', 'slick@gmail.com'])) - - def test_remove_duplicate_emails_with_routing_format(self): - mail_list = ['simbarashe<simba@gmail.com>', 'simba<simba@gmail.com>', 'Fabio<fabio@gmail.com>', 'Fabinho<fabio@gmail.com>'] - selected_recepients = self.mail_sender.get_email_addresses(mail_list) - self.assertEquals(selected_recepients, set(['simba@gmail.com', 'fabio@gmail.com'])) diff --git a/service/test/unit/adapter/test_mail_service.py b/service/test/unit/adapter/test_mail_service.py index 98ead126..f815268c 100644 --- a/service/test/unit/adapter/test_mail_service.py +++ b/service/test/unit/adapter/test_mail_service.py @@ -29,14 +29,13 @@ class TestMailService(unittest.TestCase): self.drafts = mock() self.querier = mock() self.mailboxes = mock() - self.tag_service = mock() self.mailboxes.drafts = lambda: self.drafts self.mailboxes.trash = lambda: mock() self.mailboxes.sent = lambda: mock() self.mail_sender = mock() self.search_engine = mock() - self.mail_service = MailService(self.mailboxes, self.mail_sender, self.tag_service, self.querier, self.search_engine) + self.mail_service = MailService(self.mailboxes, self.mail_sender, self.querier, self.search_engine) def tearDown(self): unstub() diff --git a/service/test/unit/adapter/test_mailbox.py b/service/test/unit/adapter/test_mailbox.py index b44f507b..5644969f 100644 --- a/service/test/unit/adapter/test_mailbox.py +++ b/service/test/unit/adapter/test_mailbox.py @@ -23,7 +23,6 @@ from test.support import test_helper class PixelatedMailboxTest(unittest.TestCase): def setUp(self): - self.tag_service = mock() self.querier = mock() self.search_engine = mock() self.mailbox = Mailbox('INBOX', self.querier, self.search_engine) |