diff options
author | mnandri <mnandri@eunglick.corporate.thoughtworks.com> | 2015-12-18 18:24:52 +0100 |
---|---|---|
committer | mnandri <mnandri@eunglick.corporate.thoughtworks.com> | 2015-12-18 18:59:29 +0100 |
commit | 8b61b34f1ed71c04afbeeb45f08a65d35a18423d (patch) | |
tree | b0afa8b8004f541e952745e57548fc613a043ce9 /service/test/integration | |
parent | b73185d27fe5d59d64b0759c1efbbcdf89086d11 (diff) |
adapting mail controllers POST and PUT to work with attachements
Issue #548
Diffstat (limited to 'service/test/integration')
-rw-r--r-- | service/test/integration/test_draft_service.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/service/test/integration/test_draft_service.py b/service/test/integration/test_draft_service.py index 00b1fcfe..4f4a9181 100644 --- a/service/test/integration/test_draft_service.py +++ b/service/test/integration/test_draft_service.py @@ -24,9 +24,24 @@ class DraftServiceTest(SoledadTestBase): @defer.inlineCallbacks def test_store_and_load_draft(self): input_mail = MailBuilder().with_body('some test text').build_input_mail() - - stored_draft = yield self.draft_service.create_draft(input_mail) + draft_id = None + stored_draft = yield self.draft_service.process_draft(draft_id, input_mail) draft = yield self.mail_store.get_mail(stored_draft.ident, include_body=True) self.assertEqual('some test text', draft.body) + + @defer.inlineCallbacks + def test_update_draft(self): + input_mail = MailBuilder().with_body('some test text').build_input_mail() + saved_mail = yield self.mail_store.add_mail('DRAFTS', input_mail.raw) + draft_id = saved_mail.ident + new_email = MailBuilder().with_body('other test text').with_ident(draft_id).build_input_mail() + + stored_draft = yield self.draft_service.process_draft(draft_id, new_email) + + old_draft = yield self.mail_store.get_mail(draft_id, include_body=True) + draft = yield self.mail_store.get_mail(stored_draft.ident, include_body=True) + + self.assertIsNone(old_draft) + self.assertEqual('other test text', draft.body) |