diff options
Diffstat (limited to 'service')
-rw-r--r-- | service/integration/__init__.py | 4 | ||||
-rw-r--r-- | service/integration/drafts_test.py | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/service/integration/__init__.py b/service/integration/__init__.py index aff5cec0..22643b95 100644 --- a/service/integration/__init__.py +++ b/service/integration/__init__.py @@ -131,6 +131,10 @@ class SoledadTestBase: response = json.loads(self.app.post('/mails', data=data, content_type="application/json").data) return ResponseMail(response) + def put_mail(self, data): + response = json.loads(self.app.put('/mails', data=data, content_type="application/json").data) + return response['ident'] + class ResponseMail: diff --git a/service/integration/drafts_test.py b/service/integration/drafts_test.py index 1f1712a8..a3ecbb2a 100644 --- a/service/integration/drafts_test.py +++ b/service/integration/drafts_test.py @@ -44,10 +44,21 @@ class DraftsTest(unittest.TestCase, SoledadTestBase): sent_mails = self.get_mails_by_tag('sent') drafts = self.get_mails_by_tag('drafts') - import pdb;pdb.set_trace() - self.assertEquals(1, len(sent_mails)) self.assertEquals('Second draft', sent_mails[0].subject) self.assertEquals(0, len(drafts)) + def test_update_draft(self): + draft = JSONMailBuilder().with_subject('First draft').build() + create_draft_response = self.post_mail(draft) + draft_ident = create_draft_response.ident + + updated_draft = JSONMailBuilder().with_subject('First draft edited').with_ident(draft_ident).build() + self.put_mail(updated_draft) + + drafts = self.get_mails_by_tag('drafts') + + self.assertEquals(1, len(drafts)) + self.assertEquals('First draft edited', drafts[0].subject) + |