From ed5520b54a7885f446671440d6a8a7bd3e05ea0b Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Mon, 22 Sep 2014 10:49:25 -0300 Subject: PixelatedMailbox to call mail#mark_as_deleted on removing mail (feature envy removal) --- service/test/adapter/pixelated_mail_test.py | 9 ++++++--- service/test/adapter/pixelated_mailbox_test.py | 7 ++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'service/test') diff --git a/service/test/adapter/pixelated_mail_test.py b/service/test/adapter/pixelated_mail_test.py index c9f5e67d..0a103cce 100644 --- a/service/test/adapter/pixelated_mail_test.py +++ b/service/test/adapter/pixelated_mail_test.py @@ -147,12 +147,15 @@ class TestPixelatedMail(unittest.TestCase): self.assertEquals(mail.leap_mail.setFlags.call_args[0], (('\\Recent',), -1)) - def test_remove_all_tags(self): - mail = PixelatedMail.from_leap_mail(test_helper.leap_mail(extra_headers={'X-Tags': '["skinka", "altoids"]'}), Mock()) + def test_mark_as_deleted(self): + mail = PixelatedMail.from_leap_mail(test_helper.leap_mail(extra_headers={'X-Tags': '["skinka", "altoids"]'}, flags=[]), Mock()) + self.assertEquals(set(['skinka', 'altoids']), mail.tags) - mail.remove_all_tags() + mail.mark_as_deleted() + self.assertEquals(set([]), mail.tags) + self.assertEquals(mail.leap_mail.setFlags.call_args[0], ((u'\\Deleted',), 1)) def test_update_tags_notifies_tag_service(self): db_path = '/tmp/test_update_tags_notifies_tag_service' diff --git a/service/test/adapter/pixelated_mailbox_test.py b/service/test/adapter/pixelated_mailbox_test.py index 8bff7e68..847ce20c 100644 --- a/service/test/adapter/pixelated_mailbox_test.py +++ b/service/test/adapter/pixelated_mailbox_test.py @@ -62,13 +62,10 @@ class PixelatedMailboxTest(unittest.TestCase): verify(leap_mailbox_messages).add_msg('smtp format mail') def test_remove_message_from_mailbox(self): - mail = PixelatedMail.from_dict(test_helper.mail_dict()) - mail.raw_message = lambda: 'the mail in smtp format' - - mail.leap_mail = mock() + mail = mock() self.mailbox.leap_mailbox = mock() self.mailbox.remove(mail) - verify(mail.leap_mail).setFlags((Status.PixelatedStatus.DELETED,), 1) + verify(mail).mark_as_deleted() verify(self.mailbox.leap_mailbox).expunge() -- cgit v1.2.3