diff options
Diffstat (limited to 'service/test/adapter')
-rw-r--r-- | service/test/adapter/pixelated_mail_test.py | 7 | ||||
-rw-r--r-- | service/test/adapter/pixelated_mailbox_test.py | 12 |
2 files changed, 16 insertions, 3 deletions
diff --git a/service/test/adapter/pixelated_mail_test.py b/service/test/adapter/pixelated_mail_test.py index 9eab3d2c..4292883c 100644 --- a/service/test/adapter/pixelated_mail_test.py +++ b/service/test/adapter/pixelated_mail_test.py @@ -119,3 +119,10 @@ class TestPixelatedMail(unittest.TestCase): mail.mark_as_read() self.assertEquals(mail.leap_mail.setFlags.call_args[0], (('\\Seen',), 1)) + + def test_mark_as_not_recent(self): + mail = PixelatedMail.from_leap_mail(test_helper.leap_mail(flags=[])) + + mail.mark_as_not_recent() + + self.assertEquals(mail.leap_mail.setFlags.call_args[0], (('\\Recent',), -1)) diff --git a/service/test/adapter/pixelated_mailbox_test.py b/service/test/adapter/pixelated_mailbox_test.py index 9ac4f53e..b4ddb32d 100644 --- a/service/test/adapter/pixelated_mailbox_test.py +++ b/service/test/adapter/pixelated_mailbox_test.py @@ -31,9 +31,15 @@ class TestPixelatedMailbox(unittest.TestCase): self.tag_service = mock() self.mailbox = PixelatedMailbox(leap_mailbox, self.tag_service) - def test_mailbox_tag_is_added_when_new_mail_arrives(self): - mails = self.mailbox.mails() - self.assertIn('sent', mails[0].tags) + def test_mailbox_tag_is_added_when_recent_mail_arrives(self): + recent_leap_mail = test_helper.leap_mail(uid=0, mbox='SPAM', flags=['\\Recent']) + mailbox = PixelatedMailbox(test_helper.leap_mailbox(messages=[recent_leap_mail], mailbox_name='SPAM')) + self.assertIn('spam', mailbox.mails()[0].tags) + + def test_mailbox_tag_is_ignored_for_non_recent_mail(self): + recent_leap_mail = test_helper.leap_mail(uid=0, mbox='SPAM', flags=[]) + mailbox = PixelatedMailbox(test_helper.leap_mailbox(messages=[recent_leap_mail], mailbox_name='SPAM')) + self.assertNotIn('spam', mailbox.mails()[0].tags) def test_add_message_to_mailbox(self): PixelatedMail.from_email_address = 'pixel@ted.org' |