summaryrefslogtreecommitdiff
path: root/service/test/unit
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-08-21 18:08:08 +0200
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-08-21 18:08:08 +0200
commit0ef2319eca0d6ae715aa12b168cbecccf497ec02 (patch)
treefc01b795792cc42dae9fde629a5eb1eda0c4a8e9 /service/test/unit
parent9f4ec7f85e23845078d84cf58bf5e17a0d5aa93e (diff)
parent912c3e5cb9a11273d7a4d33c0e7dfb438801a184 (diff)
Merge branch 'display-sent-emails-as-read' of https://github.com/rdoh/pixelated-user-agent
Diffstat (limited to 'service/test/unit')
-rw-r--r--service/test/unit/adapter/test_mail_service.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/service/test/unit/adapter/test_mail_service.py b/service/test/unit/adapter/test_mail_service.py
index de140997..043e3913 100644
--- a/service/test/unit/adapter/test_mail_service.py
+++ b/service/test/unit/adapter/test_mail_service.py
@@ -66,6 +66,10 @@ class TestMailService(unittest.TestCase):
deferred_success = defer.succeed(None)
when(self.mail_sender).sendmail(ANY()).thenReturn(deferred_success)
+ sent_mail = LeapMail('id', 'INBOX')
+ add_mail_deferral = defer.succeed(sent_mail)
+ when(self.mail_store).add_mail('SENT', ANY()).thenReturn(add_mail_deferral)
+
yield self.mail_service.send_mail({'ident': '12'})
verify(self.mail_sender).sendmail(mail)
@@ -73,6 +77,23 @@ class TestMailService(unittest.TestCase):
verify(self.mail_store).delete_mail('12')
@defer.inlineCallbacks
+ def test_send_mail_marks_as_read(self):
+ mail = LeapMail('id', 'INBOX')
+ when(mail).raw = 'raw mail'
+ when(InputMail).from_dict(ANY()).thenReturn(mail)
+ when(self.mail_store).delete_mail('12').thenReturn(defer.succeed(None))
+ when(self.mail_sender).sendmail(ANY()).thenReturn(defer.succeed(None))
+
+ sent_mail = LeapMail('id', 'INBOX')
+ add_mail_deferral = defer.succeed(sent_mail)
+ when(self.mail_store).add_mail('SENT', ANY()).thenReturn(add_mail_deferral)
+
+ yield self.mail_service.send_mail({'ident': '12'})
+
+ self.assertIn(Status.SEEN, sent_mail.flags)
+ verify(self.mail_store).update_mail(sent_mail)
+
+ @defer.inlineCallbacks
def test_send_mail_does_not_delete_draft_on_error(self):
when(InputMail).from_dict(ANY()).thenReturn('inputmail')