diff options
author | Duda Dornelles <ddornell@thoughtworks.com> | 2014-09-29 18:08:33 -0300 |
---|---|---|
committer | Duda Dornelles <ddornell@thoughtworks.com> | 2014-09-29 18:08:33 -0300 |
commit | e29d92b6fbf651d967271820e5f4bcde6ba47d39 (patch) | |
tree | 384549c69016b72a47cbac3eb5c8008f708af2ac /service | |
parent | 7fa4661018272edaf11109efdb9ff834d365f3ab (diff) |
Adding integration test to update draft
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) + |