summaryrefslogtreecommitdiff
path: root/service/test/adapter
diff options
context:
space:
mode:
authorPatrick Maia and Victor Shyba <pixelated-team+pmaia+vshyba@thoughtworks.com>2014-09-08 08:26:52 +0000
committerPatrick Maia <pmaia@thoughtworks.com>2014-09-08 08:29:54 +0000
commit10112b7d862f5d2d24b6c295e08c4ebd73d54ee2 (patch)
treea5f820ee555941ac9c0a921d7e6e33296f0b111d /service/test/adapter
parent4d654c66af16d0b737669865758faf24b9e77378 (diff)
\#72 - adds tag with the name of the mailbox on all mails that does not have it during mails fetch
Diffstat (limited to 'service/test/adapter')
-rw-r--r--service/test/adapter/pixelated_mailbox_test.py9
-rw-r--r--service/test/adapter/test_helper.py3
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)