class PixelatedMailboxTest(unittest.TestCase): def setUp(self): self.tag_service = mock() self.querier = mock() 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) when(self.querier).mail(1).thenReturn(mail) self.mailbox.remove(1) verify(self.querier).remove_mail(mail)
class PixelatedMailboxTest(unittest.TestCase): def setUp(self): self.querier = mock() self.search_engine = mock() self.mailbox = Mailbox("INBOX", self.querier, self.search_engine) def test_remove_message_from_mailbox(self): mail = PixelatedMail.from_soledad(*test_helper.leap_mail(), soledad_querier=self.querier) when(self.querier).mail(1).thenReturn(mail) self.mailbox.remove(1) verify(self.querier).remove_mail(mail) def test_fresh_mailbox_checking_lastuid(self): when(self.querier).get_lastuid("INBOX").thenReturn(0) self.assertTrue(self.mailbox.fresh) when(self.querier).get_lastuid("INBOX").thenReturn(1) self.assertFalse(self.mailbox.fresh)
class PixelatedMailboxTest(unittest.TestCase): def setUp(self): self.querier = mock() self.search_engine = mock() self.mailbox = Mailbox('INBOX', self.querier, self.search_engine) def test_remove_message_from_mailbox(self): mail = PixelatedMail.from_soledad(*test_helper.leap_mail(), soledad_querier=self.querier) when(self.querier).mail(1).thenReturn(mail) self.mailbox.remove(1) verify(self.querier).remove_mail(mail) def test_fresh_mailbox_checking_lastuid(self): when(self.querier).get_lastuid('INBOX').thenReturn(0) self.assertTrue(self.mailbox.fresh) when(self.querier).get_lastuid('INBOX').thenReturn(1) self.assertFalse(self.mailbox.fresh)
def _create_or_get(self, mailbox_name): mailbox_name = mailbox_name.upper() # if mailbox_name not in self.account.mailboxes: if mailbox_name not in (yield self.account.account.list_all_mailbox_names()): try: yield self.account.addMailbox(mailbox_name) except MailboxCollision: pass # It means that it is already created. FIXME Why list_all fails to tell? yield MailboxIndexerListener.listen(self.account, mailbox_name, self.querier) defer.returnValue(Mailbox.create(mailbox_name, self.querier, self.search_engine))
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) MailboxIndexerListener.listen(self.account, mailbox_name, self.querier) return Mailbox.create(mailbox_name, self.querier, self.search_engine)
def setUp(self): self.tag_service = mock() self.querier = mock() self.mailbox = Mailbox('INBOX', self.querier)
def setUp(self): self.querier = mock() self.search_engine = mock() self.mailbox = Mailbox('INBOX', self.querier, self.search_engine)