diff options
author | Duda Dornelles <ddornell@thoughtworks.com> | 2014-10-15 16:39:32 +0200 |
---|---|---|
committer | Duda Dornelles <ddornell@thoughtworks.com> | 2014-10-15 16:39:37 +0200 |
commit | b2334df7a677047749d411dda4cd4cd58474ee8a (patch) | |
tree | cc0b28ce9d55d9c68f9a284ebdfdccec47fbcab0 | |
parent | c526bab6a5cc91182481d2565b0e762a66572bef (diff) |
getting rid of "pixelated" in the names of many classes - redundant
-rw-r--r-- | service/pixelated/adapter/mail_sender.py (renamed from service/pixelated/adapter/pixelated_mail_sender.py) | 2 | ||||
-rw-r--r-- | service/pixelated/adapter/mailbox.py (renamed from service/pixelated/adapter/pixelated_mailbox.py) | 4 | ||||
-rw-r--r-- | service/pixelated/adapter/mailbox_indexer_listener.py (renamed from service/pixelated/adapter/listener.py) | 4 | ||||
-rw-r--r-- | service/pixelated/adapter/mailboxes.py (renamed from service/pixelated/adapter/pixelated_mailboxes.py) | 12 | ||||
-rw-r--r-- | service/pixelated/config/app_factory.py | 12 | ||||
-rw-r--r-- | service/test/functional/features/environment.py | 2 | ||||
-rw-r--r-- | service/test/integration/tags_test.py | 2 | ||||
-rw-r--r-- | service/test/support/integration_helper.py | 10 | ||||
-rw-r--r-- | service/test/unit/adapter/mail_sender_test.py (renamed from service/test/unit/adapter/pixelated_mail_sender_test.py) | 6 | ||||
-rw-r--r-- | service/test/unit/adapter/mail_test.py (renamed from service/test/unit/adapter/pixelated_mail_test.py) | 0 | ||||
-rw-r--r-- | service/test/unit/adapter/mailbox_indexer_listener_test.py (renamed from service/test/unit/adapter/listener_test.py) | 12 | ||||
-rw-r--r-- | service/test/unit/adapter/mailbox_test.py (renamed from service/test/unit/adapter/pixelated_mailbox_test.py) | 4 | ||||
-rw-r--r-- | service/test/unit/adapter/mailboxes_test.py (renamed from service/test/unit/adapter/pixelated_mailboxes_test.py) | 8 | ||||
-rw-r--r-- | service/test/unit/runserver_test.py (renamed from service/test/unit/user_agent_test.py) | 31 |
14 files changed, 55 insertions, 54 deletions
diff --git a/service/pixelated/adapter/pixelated_mail_sender.py b/service/pixelated/adapter/mail_sender.py index bae86cd2..1802a9d5 100644 --- a/service/pixelated/adapter/pixelated_mail_sender.py +++ b/service/pixelated/adapter/mail_sender.py @@ -18,7 +18,7 @@ import smtplib from pixelated.support.functional import flatten -class PixelatedMailSender(): +class MailSender(): def __init__(self, account_email_address, smtp_client=None): self.account_email_address = account_email_address self.smtp_client = smtp_client or smtplib.SMTP('localhost', 4650) diff --git a/service/pixelated/adapter/pixelated_mailbox.py b/service/pixelated/adapter/mailbox.py index 283567db..b5f2e6ea 100644 --- a/service/pixelated/adapter/pixelated_mailbox.py +++ b/service/pixelated/adapter/mailbox.py @@ -15,7 +15,7 @@ # along with Pixelated. If not, see <http://www.gnu.org/licenses/>. -class PixelatedMailbox: +class Mailbox: def __init__(self, mailbox_name, querier): self.mailbox_name = mailbox_name @@ -50,4 +50,4 @@ class PixelatedMailbox: @classmethod def create(cls, mailbox_name, soledad_querier): - return PixelatedMailbox(mailbox_name, soledad_querier) + return Mailbox(mailbox_name, soledad_querier) diff --git a/service/pixelated/adapter/listener.py b/service/pixelated/adapter/mailbox_indexer_listener.py index 67d75df7..a7309118 100644 --- a/service/pixelated/adapter/listener.py +++ b/service/pixelated/adapter/mailbox_indexer_listener.py @@ -15,14 +15,14 @@ # along with Pixelated. If not, see <http://www.gnu.org/licenses/>. -class MailboxListener(object): +class MailboxIndexerListener(object): """ Listens for new mails, keeping the index updated """ SEARCH_ENGINE = None @classmethod def listen(cls, account, mailbox_name, soledad_querier): - listener = MailboxListener(mailbox_name, soledad_querier) + listener = MailboxIndexerListener(mailbox_name, soledad_querier) if listener not in account.getMailbox(mailbox_name).listeners: account.getMailbox(mailbox_name).addListener(listener) diff --git a/service/pixelated/adapter/pixelated_mailboxes.py b/service/pixelated/adapter/mailboxes.py index 79c007cb..241a8050 100644 --- a/service/pixelated/adapter/pixelated_mailboxes.py +++ b/service/pixelated/adapter/mailboxes.py @@ -13,24 +13,24 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see <http://www.gnu.org/licenses/>. -from pixelated.adapter.pixelated_mailbox import PixelatedMailbox -from pixelated.adapter.listener import MailboxListener +from pixelated.adapter.mailbox import Mailbox +from pixelated.adapter.mailbox_indexer_listener import MailboxIndexerListener -class PixelatedMailBoxes(): +class Mailboxes(): def __init__(self, account, soledad_querier): self.account = account self.querier = soledad_querier for mailbox_name in account.mailboxes: - MailboxListener.listen(self.account, mailbox_name, soledad_querier) + MailboxIndexerListener.listen(self.account, mailbox_name, soledad_querier) def _create_or_get(self, mailbox_name): mailbox_name = mailbox_name.upper() if mailbox_name not in self.account.mailboxes: self.account.addMailbox(mailbox_name) - MailboxListener.listen(self.account, mailbox_name, self.querier) - return PixelatedMailbox.create(mailbox_name, self.querier) + MailboxIndexerListener.listen(self.account, mailbox_name, self.querier) + return Mailbox.create(mailbox_name, self.querier) def inbox(self): return self._create_or_get('INBOX') diff --git a/service/pixelated/config/app_factory.py b/service/pixelated/config/app_factory.py index 596046c1..6c9c07fe 100644 --- a/service/pixelated/config/app_factory.py +++ b/service/pixelated/config/app_factory.py @@ -16,12 +16,12 @@ from pixelated.adapter.mail_service import MailService from pixelated.adapter.mail import InputMail -from pixelated.adapter.pixelated_mail_sender import PixelatedMailSender -from pixelated.adapter.pixelated_mailboxes import PixelatedMailBoxes +from pixelated.adapter.mail_sender import MailSender +from pixelated.adapter.mailboxes import Mailboxes from pixelated.adapter.soledad_querier import SoledadQuerier from pixelated.adapter.search import SearchEngine from pixelated.adapter.draft_service import DraftService -from pixelated.adapter.listener import MailboxListener +from pixelated.adapter.mailbox_indexer_listener import MailboxIndexerListener import pixelated.bitmask_libraries.session as LeapSession from pixelated.controllers import * from pixelated.adapter.tag_service import TagService @@ -55,14 +55,14 @@ def create_app(debug_enabled, app): app.config['LEAP_SERVER_NAME']) tag_service = TagService() soledad_querier = SoledadQuerier(soledad=leap_session.account._soledad) - pixelated_mailboxes = PixelatedMailBoxes(leap_session.account, soledad_querier) - pixelated_mail_sender = PixelatedMailSender(leap_session.account_email()) + pixelated_mailboxes = Mailboxes(leap_session.account, soledad_querier) + pixelated_mail_sender = MailSender(leap_session.account_email()) mail_service = MailService(pixelated_mailboxes, pixelated_mail_sender, tag_service, soledad_querier) search_engine = SearchEngine() search_engine.index_mails(mail_service.all_mails()) draft_service = DraftService(pixelated_mailboxes) - MailboxListener.SEARCH_ENGINE = search_engine + MailboxIndexerListener.SEARCH_ENGINE = search_engine InputMail.FROM_EMAIL_ADDRESS = leap_session.account_email() home_controller = HomeController() diff --git a/service/test/functional/features/environment.py b/service/test/functional/features/environment.py index 86f43d7f..9b587497 100644 --- a/service/test/functional/features/environment.py +++ b/service/test/functional/features/environment.py @@ -25,7 +25,7 @@ def before_all(context): context.soledad_test_base = SoledadTestBase() context.soledad_test_base.setup_soledad() - context.mailboxes = context.soledad_test_base.pixelated_mailboxes + context.mailboxes = context.soledad_test_base.mailboxes context.app = pixelated.runserver.app context.app.mail_service = context.soledad_test_base.mail_service diff --git a/service/test/integration/tags_test.py b/service/test/integration/tags_test.py index 351713eb..bd22e4b5 100644 --- a/service/test/integration/tags_test.py +++ b/service/test/integration/tags_test.py @@ -49,5 +49,5 @@ class TagsTest(unittest.TestCase, SoledadTestBase): response = self.post_tags(mail.ident, self._tags_json(['DRAFTS'])) self.assertEquals("None of the following words can be used as tags: drafts", response) - mail = self.pixelated_mailboxes.inbox().mail(mail.ident) + mail = self.mailboxes.inbox().mail(mail.ident) self.assertNotIn('drafts', mail.tags) diff --git a/service/test/support/integration_helper.py b/service/test/support/integration_helper.py index 8f2b8192..268eb812 100644 --- a/service/test/support/integration_helper.py +++ b/service/test/support/integration_helper.py @@ -25,7 +25,7 @@ from pixelated.adapter.tag_service import TagService from pixelated.adapter.draft_service import DraftService from pixelated.adapter.mail import PixelatedMail, InputMail import pixelated.runserver -from pixelated.adapter.pixelated_mailboxes import PixelatedMailBoxes +from pixelated.adapter.mailboxes import Mailboxes from pixelated.adapter.soledad_querier import SoledadQuerier from pixelated.controllers import * import pixelated.config.app_factory as app_factory @@ -153,11 +153,11 @@ class SoledadTestBase: self._reset_routes(self.client.application) self.soledad_querier = SoledadQuerier(self.soledad) self.account = FakeAccount() - self.pixelated_mailboxes = PixelatedMailBoxes(self.account, self.soledad_querier) + self.mailboxes = Mailboxes(self.account, self.soledad_querier) self.mail_sender = mock() self.tag_service = TagService() - self.draft_service = DraftService(self.pixelated_mailboxes) - self.mail_service = MailService(self.pixelated_mailboxes, self.mail_sender, self.tag_service, + self.draft_service = DraftService(self.mailboxes) + self.mail_service = MailService(self.mailboxes, self.mail_sender, self.tag_service, self.soledad_querier) self.search_engine = SearchEngine() self.search_engine.index_mails(self.mail_service.all_mails()) @@ -206,7 +206,7 @@ class SoledadTestBase: self.client.post('/mails/unread', data={'idents': json.dumps(idents)}) def add_mail_to_inbox(self, input_mail): - mail = self.pixelated_mailboxes.inbox().add(input_mail) + mail = self.mailboxes.inbox().add(input_mail) mail.update_tags(input_mail.tags) self.search_engine.index_mail(mail) diff --git a/service/test/unit/adapter/pixelated_mail_sender_test.py b/service/test/unit/adapter/mail_sender_test.py index 01de1cb0..721d61b7 100644 --- a/service/test/unit/adapter/pixelated_mail_sender_test.py +++ b/service/test/unit/adapter/mail_sender_test.py @@ -16,16 +16,16 @@ import unittest from pixelated.adapter.mail import PixelatedMail -from pixelated.adapter.pixelated_mail_sender import PixelatedMailSender +from pixelated.adapter.mail_sender import MailSender from mockito import * from test.support import test_helper -class PixelatedMailSenderTest(unittest.TestCase): +class MailSenderTest(unittest.TestCase): def setUp(self): self.mail_address = "pixelated@pixelated.org" self.smtp_client = mock() - self.mail_sender = PixelatedMailSender(self.mail_address, self.smtp_client) + self.mail_sender = MailSender(self.mail_address, self.smtp_client) def test_send_mail_sends_to_To_Cc_and_Bcc(self): headers = { diff --git a/service/test/unit/adapter/pixelated_mail_test.py b/service/test/unit/adapter/mail_test.py index 20038e96..20038e96 100644 --- a/service/test/unit/adapter/pixelated_mail_test.py +++ b/service/test/unit/adapter/mail_test.py diff --git a/service/test/unit/adapter/listener_test.py b/service/test/unit/adapter/mailbox_indexer_listener_test.py index e131aebd..1f28ec7b 100644 --- a/service/test/unit/adapter/listener_test.py +++ b/service/test/unit/adapter/mailbox_indexer_listener_test.py @@ -16,7 +16,7 @@ import unittest from mockito import * -from pixelated.adapter.listener import MailboxListener +from pixelated.adapter.mailbox_indexer_listener import MailboxIndexerListener class MailboxListenerTest(unittest.TestCase): @@ -32,19 +32,19 @@ class MailboxListenerTest(unittest.TestCase): mailbox.listeners = set() when(mailbox).addListener = lambda x: mailbox.listeners.add(x) - self.assertNotIn(MailboxListener('INBOX', self.querier), mailbox.listeners) + self.assertNotIn(MailboxIndexerListener('INBOX', self.querier), mailbox.listeners) - MailboxListener.listen(self.account, 'INBOX', self.querier) + MailboxIndexerListener.listen(self.account, 'INBOX', self.querier) - self.assertIn(MailboxListener('INBOX', self.querier), mailbox.listeners) + self.assertIn(MailboxIndexerListener('INBOX', self.querier), mailbox.listeners) def test_reindex_missing_idents(self): search_engine = mock() when(search_engine).search('tag:inbox').thenReturn(['ident1', 'ident2']) - MailboxListener.SEARCH_ENGINE = search_engine + MailboxIndexerListener.SEARCH_ENGINE = search_engine - listener = MailboxListener('INBOX', self.querier) + listener = MailboxIndexerListener('INBOX', self.querier) when(self.querier).idents_by_mailbox('INBOX').thenReturn({'ident1', 'ident2', 'missing_ident'}) self.querier.used_arguments = [] self.querier.mails = lambda x: self.querier.used_arguments.append(x) diff --git a/service/test/unit/adapter/pixelated_mailbox_test.py b/service/test/unit/adapter/mailbox_test.py index 0a007ba6..df46d02d 100644 --- a/service/test/unit/adapter/pixelated_mailbox_test.py +++ b/service/test/unit/adapter/mailbox_test.py @@ -16,7 +16,7 @@ import unittest from pixelated.adapter.mail import PixelatedMail -from pixelated.adapter.pixelated_mailbox import PixelatedMailbox +from pixelated.adapter.mailbox import Mailbox from mockito import * from test.support import test_helper @@ -25,7 +25,7 @@ class PixelatedMailboxTest(unittest.TestCase): def setUp(self): self.tag_service = mock() self.querier = mock() - self.mailbox = PixelatedMailbox('INBOX', self.querier) + self.mailbox = Mailbox('INBOX', self.querier) def test_remove_message_from_mailbox(self): mail = PixelatedMail.from_soledad(*test_helper.leap_mail(), soledad_querier=self.querier) diff --git a/service/test/unit/adapter/pixelated_mailboxes_test.py b/service/test/unit/adapter/mailboxes_test.py index 3ca8cc2f..cbed4577 100644 --- a/service/test/unit/adapter/pixelated_mailboxes_test.py +++ b/service/test/unit/adapter/mailboxes_test.py @@ -16,8 +16,8 @@ import unittest from mockito import * -from pixelated.adapter.pixelated_mailbox import PixelatedMailbox -from pixelated.adapter.pixelated_mailboxes import PixelatedMailBoxes +from pixelated.adapter.mailbox import Mailbox +from pixelated.adapter.mailboxes import Mailboxes class PixelatedMailboxesTest(unittest.TestCase): @@ -28,7 +28,7 @@ class PixelatedMailboxesTest(unittest.TestCase): self.account.mailboxes = [] self.drafts_mailbox = mock() self.drafts_mailbox.mailbox_name = 'drafts' - self.mailboxes = PixelatedMailBoxes(self.account, self.querier) + self.mailboxes = Mailboxes(self.account, self.querier) self.mailboxes.drafts = lambda: self.drafts_mailbox def test_search_for_tags(self): @@ -37,7 +37,7 @@ class PixelatedMailboxesTest(unittest.TestCase): tags_to_search_for = {'tags': ['inbox', 'custom_tag']} - when(PixelatedMailbox).create('INBOX', self.querier).thenReturn(mailbox) + when(Mailbox).create('INBOX', self.querier).thenReturn(mailbox) when(mailbox).mails_by_tags(any(list)).thenReturn(["mail"]) mails = self.mailboxes.mails_by_tag(tags_to_search_for['tags']) diff --git a/service/test/unit/user_agent_test.py b/service/test/unit/runserver_test.py index bd875dcc..1e735bf7 100644 --- a/service/test/unit/user_agent_test.py +++ b/service/test/unit/runserver_test.py @@ -17,42 +17,43 @@ import unittest import sys -import pixelated.user_agent +import pixelated.runserver from mockito import * import crochet import pixelated.config.reactor_manager as reactor_manager -import pixelated.adapter.pixelated_mail +import pixelated.adapter.mail import os +import pixelated.config.app_factory as app_factory -class UserAgentTest(unittest.TestCase): +class RunserverTest(unittest.TestCase): def test_that_default_config_file_is_home_dot_pixelated(self): - orig_config = pixelated.user_agent.app.config + orig_config = pixelated.runserver.app.config try: when(crochet).setup().thenReturn(None) when(reactor_manager).start_reactor().thenReturn(None) - when(pixelated.user_agent).start_user_agent().thenReturn(None) - pixelated.user_agent.app.config = mock() + when(app_factory).create_app().thenReturn(None) + pixelated.runserver.app.config = mock() sys.argv = ['/tmp/does_not_exist'] - pixelated.user_agent.setup() + pixelated.runserver.setup() - verify(pixelated.user_agent.app.config).from_pyfile(os.path.join(os.environ['HOME'], '.pixelated')) + verify(pixelated.runserver.app.config).from_pyfile(os.path.join(os.environ['HOME'], '.pixelated')) finally: - pixelated.user_agent.app.config = orig_config + pixelated.runserver.app.config = orig_config def test_that_config_file_can_be_specified_on_command_line(self): - orig_config = pixelated.user_agent.app.config + orig_config = pixelated.runserver.app.config try: when(crochet).setup().thenReturn(None) when(reactor_manager).start_reactor().thenReturn(None) - when(pixelated.user_agent).start_user_agent().thenReturn(None) - pixelated.user_agent.app.config = mock() + when(app_factory).create_app().thenReturn(None) + pixelated.runserver.app.config = mock() sys.argv = ['/tmp/does_not_exist', '--config', '/tmp/some/config/file'] - pixelated.user_agent.setup() + pixelated.runserver.setup() - verify(pixelated.user_agent.app.config).from_pyfile('/tmp/some/config/file') + verify(pixelated.runserver.app.config).from_pyfile('/tmp/some/config/file') finally: - pixelated.user_agent.app.config = orig_config + pixelated.runserver.app.config = orig_config |