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 | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/service/test/adapter/pixelated_mailbox_test.py b/service/test/adapter/pixelated_mailbox_test.py index 2944275f..e763d8fe 100644 --- a/service/test/adapter/pixelated_mailbox_test.py +++ b/service/test/adapter/pixelated_mailbox_test.py @@ -53,3 +53,12 @@ class TestPixelatedMailbox(unittest.TestCase): self.assertEquals(0, mailbox.tag_index.get('inbox').total) mailbox.notify_tags_updated(set(['inbox']), set(['one_tag']), 12) self.assertEquals(1, mailbox.tag_index.get('inbox').total) + + 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']}) + + leap_mailbox = test_helper.leap_mailbox(messages=[mail_one, mail_two]) + + mailbox = PixelatedMailbox(leap_mailbox, self.db_file_path) + self.assertEquals(set([Tag('tag_1'), Tag('tag_2'), Tag('inbox'), Tag('sent'), Tag('drafts'), Tag('trash')]), mailbox.all_tags()) diff --git a/service/test/adapter/test_helper.py b/service/test/adapter/test_helper.py index 70673481..7bf19a42 100644 --- a/service/test/adapter/test_helper.py +++ b/service/test/adapter/test_helper.py @@ -49,6 +49,6 @@ def leap_mail(uid=0, flags=LEAP_FLAGS, headers=DEFAULT_HEADERS, extra_headers={} hdoc=Mock(content={'headers': headers})) -def leap_mailbox(): +def leap_mailbox(messages=[leap_mail(uid=6)]): return Mock(_get_mbox_doc=Mock(return_value=None), - messages=[leap_mail(uid=6)]) + messages=messages) |