diff options
Diffstat (limited to 'service/test')
-rw-r--r-- | service/test/adapter/pixelated_mailbox_test.py | 9 | ||||
-rw-r--r-- | service/test/adapter/test_helper.py | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/service/test/adapter/pixelated_mailbox_test.py b/service/test/adapter/pixelated_mailbox_test.py index 72e6141d..9bc65de0 100644 --- a/service/test/adapter/pixelated_mailbox_test.py +++ b/service/test/adapter/pixelated_mailbox_test.py @@ -57,6 +57,15 @@ class TestPixelatedMailbox(unittest.TestCase): self.assertEquals(1, mailbox.tag_index.get('inbox').total) self.assertIsNone(mailbox.tag_index.get('one_tag')) + def test_mailbox_tag_is_added_when_new_mail_arrives(self): + mail_one = test_helper.leap_mail(uid=0) + + leap_mailbox = test_helper.leap_mailbox(messages=[mail_one], mailbox_name='SENT') + mailbox = PixelatedMailbox(leap_mailbox, self.db_file_path) + + mail = mailbox.mail(0) + self.assertIn('sent', mail.tags) + def test_index_is_initialized_with_mail_tags_if_empty(self): mail_one = test_helper.leap_mail(uid=0, extra_headers={'X-Tags': ['tag_1']}) mail_two = test_helper.leap_mail(uid=1, extra_headers={'X-Tags': ['tag_2']}) diff --git a/service/test/adapter/test_helper.py b/service/test/adapter/test_helper.py index 7bf19a42..a904a041 100644 --- a/service/test/adapter/test_helper.py +++ b/service/test/adapter/test_helper.py @@ -49,6 +49,7 @@ def leap_mail(uid=0, flags=LEAP_FLAGS, headers=DEFAULT_HEADERS, extra_headers={} hdoc=Mock(content={'headers': headers})) -def leap_mailbox(messages=[leap_mail(uid=6)]): +def leap_mailbox(messages=[leap_mail(uid=6)], mailbox_name='INBOX'): return Mock(_get_mbox_doc=Mock(return_value=None), + mbox=mailbox_name, messages=messages) |