diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-21 18:08:22 +0200 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-21 18:10:17 +0200 |
commit | 0167b08279465edd8b93a4b9b0cf2b93955c6fdd (patch) | |
tree | 32ce6ee4f93bec8022485900cdbf379601f6ceb1 /service/test | |
parent | 0ef2319eca0d6ae715aa12b168cbecccf497ec02 (diff) |
Small refactoring of previous merge.
- Issue #374
Diffstat (limited to 'service/test')
-rw-r--r-- | service/test/unit/adapter/test_mail_service.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/service/test/unit/adapter/test_mail_service.py b/service/test/unit/adapter/test_mail_service.py index 043e3913..0f4ea032 100644 --- a/service/test/unit/adapter/test_mail_service.py +++ b/service/test/unit/adapter/test_mail_service.py @@ -57,23 +57,19 @@ class TestMailService(unittest.TestCase): @defer.inlineCallbacks def test_send_mail_removes_draft(self): - mail = mock() + 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_store).add_mail('SENT', ANY()).thenReturn(defer.succeed(None)) + when(self.mail_store).add_mail('SENT', ANY()).thenReturn(mail) 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) - verify(self.mail_store).add_mail('SENT', 'raw mail') + verify(self.mail_store).add_mail('SENT', mail.raw) verify(self.mail_store).delete_mail('12') @defer.inlineCallbacks |