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.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)