diff options
author | Gislene Pereira <gislene01@gmail.com> | 2015-09-04 15:42:43 -0300 |
---|---|---|
committer | Gislene Pereira <gislene01@gmail.com> | 2015-09-04 15:42:43 -0300 |
commit | ec7fc9004b6c7a25d83dd05f05955574403f65f8 (patch) | |
tree | fac9444fbaafa2e080969ac449d7bfef2db57206 /service | |
parent | 5421b5aab20daa59bc378191522db009a557aa68 (diff) |
#432 - Adding test_mark_as_read and refactoring existing test_mark_as_read in TestMailService - Gil/Shyba
Diffstat (limited to 'service')
-rw-r--r-- | service/test/unit/adapter/test_mail_service.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/service/test/unit/adapter/test_mail_service.py b/service/test/unit/adapter/test_mail_service.py index 7dd68706..c1450625 100644 --- a/service/test/unit/adapter/test_mail_service.py +++ b/service/test/unit/adapter/test_mail_service.py @@ -104,14 +104,26 @@ class TestMailService(unittest.TestCase): @defer.inlineCallbacks def test_mark_as_read(self): - mail = LeapMail('id', 'INBOX') - when(self.mail_store).get_mail(ANY(), include_body=True).thenReturn(mail) + mail = LeapMail(1, 'INBOX') + when(self.mail_store).get_mail(1, include_body=True).thenReturn(mail) yield self.mail_service.mark_as_read(1) self.assertIn(Status.SEEN, mail.flags) verify(self.mail_store).update_mail(mail) @defer.inlineCallbacks + def test_mark_as_unread(self): + mail = LeapMail(1, 'INBOX') + mail.flags.add(Status.SEEN) + + when(self.mail_store).get_mail(1, include_body=True).thenReturn(mail) + yield self.mail_service.mark_as_unread(1) + + verify(self.mail_store).update_mail(mail) + + self.assertNotEqual(mail.status, Status.SEEN) + + @defer.inlineCallbacks def test_delete_mail(self): mail_to_delete = LeapMail(1, 'INBOX') when(self.mail_store).get_mail(1, include_body=True).thenReturn(defer.succeed(mail_to_delete)) |