From 0de9d8dc31298921f7272d74cdd3c5d4217b5841 Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Thu, 16 Oct 2014 13:53:16 +0200 Subject: decreasing count on tag and tag shortcut when email is read. we were decreasing only tags that were also in the read mail, but we have also to look at the mailbox and compare that to the tags in the case of default tags #95 --- service/test/unit/adapter/mail_test.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'service/test') diff --git a/service/test/unit/adapter/mail_test.py b/service/test/unit/adapter/mail_test.py index 20038e96..94578a05 100644 --- a/service/test/unit/adapter/mail_test.py +++ b/service/test/unit/adapter/mail_test.py @@ -19,10 +19,10 @@ import pixelated.support.date from pixelated.adapter.mail import PixelatedMail, InputMail from mockito import * from test.support import test_helper +import dateutil.parser as dateparser class TestPixelatedMail(unittest.TestCase): - def setUp(self): self.querier = mock() @@ -68,6 +68,28 @@ class TestPixelatedMail(unittest.TestCase): self.assertEquals(mail.fdoc.content['flags'], []) + def test_as_dict(self): + fdoc, hdoc, bdoc = test_helper.leap_mail(flags=['\\Recent']) + hdoc.content['headers']['Subject'] = 'The subject' + hdoc.content['headers']['From'] = 'me@pixelated.org' + + mail = PixelatedMail.from_soledad(fdoc, hdoc, bdoc, soledad_querier=self.querier) + + _dict = mail.as_dict() + + self.assertEquals(_dict, {'body': 'body', + 'header': { + 'date': dateparser.parse(hdoc.content['date']).isoformat(), + 'from': 'me@pixelated.org', + 'subject': 'The subject' + }, + 'ident': 'chash', + 'mailbox': 'inbox', + 'security_casing': {}, + 'status': ['recent'], + 'tags': []} + ) + class InputMailTest(unittest.TestCase): mail_dict = lambda x: { -- cgit v1.2.3