diff options
Diffstat (limited to 'service/test/unit/adapter')
-rw-r--r-- | service/test/unit/adapter/test_mail.py | 22 | ||||
-rw-r--r-- | service/test/unit/adapter/test_mail_service.py | 11 |
2 files changed, 11 insertions, 22 deletions
diff --git a/service/test/unit/adapter/test_mail.py b/service/test/unit/adapter/test_mail.py index 03a37c1f..79039b75 100644 --- a/service/test/unit/adapter/test_mail.py +++ b/service/test/unit/adapter/test_mail.py @@ -91,28 +91,6 @@ class TestPixelatedMail(unittest.TestCase): self.assertEqual(mail.headers['Date'], date_expected) - @defer.inlineCallbacks - def test_update_tags_return_a_set_with_the_current_tags(self): - soledad_docs = test_helper.leap_mail(extra_headers={'X-tags': '["custom_1", "custom_2"]'}) - pixelated_mail = PixelatedMail.from_soledad(*soledad_docs, soledad_querier=self.querier) - - current_tags = yield pixelated_mail.update_tags({'custom_1', 'custom_3'}) - self.assertEquals({'custom_3', 'custom_1'}, current_tags) - - def test_mark_as_read(self): - mail = PixelatedMail.from_soledad(*test_helper.leap_mail(flags=[]), soledad_querier=self.querier) - - mail.mark_as_read() - - self.assertEquals(mail.fdoc.content['flags'], ['\\Seen']) - - def test_mark_as_not_recent(self): - mail = PixelatedMail.from_soledad(*test_helper.leap_mail(flags=['\\Recent']), soledad_querier=self.querier) - - mail.mark_as_not_recent() - - self.assertEquals(mail.fdoc.content['flags'], []) - def test_get_for_save_adds_from(self): InputMail.FROM_EMAIL_ADDRESS = 'me@pixelated.org' headers = {'Subject': 'The subject', diff --git a/service/test/unit/adapter/test_mail_service.py b/service/test/unit/adapter/test_mail_service.py index 677745f2..7dd68706 100644 --- a/service/test/unit/adapter/test_mail_service.py +++ b/service/test/unit/adapter/test_mail_service.py @@ -138,3 +138,14 @@ class TestMailService(unittest.TestCase): attachment = yield self.mail_service.attachment('some attachment id') self.assertEqual(attachment_dict, attachment) + + @defer.inlineCallbacks + def test_update_tags_return_a_set_with_the_current_tags(self): + mail = LeapMail(1, 'INBOX', tags={'custom_1', 'custom_2'}) + when(self.mail_store).get_mail(1, include_body=True).thenReturn(mail) + when(self.search_engine).tags(query='', skip_default_tags=True).thenReturn([]) + + updated_mail = yield self.mail_service.update_tags(1, {'custom_1', 'custom_3'}) + + verify(self.mail_store).update_mail(mail) + self.assertEqual({'custom_1', 'custom_3'}, updated_mail.tags) |