diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-07-21 15:12:41 +0000 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-11 17:00:27 +0200 |
commit | 8d62e433994e65484f97dd4f89b2e4279ce4b3dd (patch) | |
tree | 9972fb585d16c91f807dd8cc509a283e57ed69b9 /service/test | |
parent | ba1d6edfc144c0549e88392a8414a147a9f30931 (diff) |
Fixed test_mark_as_read_unread.py.
Diffstat (limited to 'service/test')
-rw-r--r-- | service/test/integration/test_mark_as_read_unread.py | 40 | ||||
-rw-r--r-- | service/test/support/integration/app_test_client.py | 6 |
2 files changed, 24 insertions, 22 deletions
diff --git a/service/test/integration/test_mark_as_read_unread.py b/service/test/integration/test_mark_as_read_unread.py index 896a51d1..b2249b54 100644 --- a/service/test/integration/test_mark_as_read_unread.py +++ b/service/test/integration/test_mark_as_read_unread.py @@ -35,67 +35,69 @@ class MarkAsReadUnreadTest(SoledadTestBase): mails = yield self.get_mails_by_tag('inbox') self.assertIn('read', mails[0].status) + @defer.inlineCallbacks def test_mark_single_as_unread(self): input_mail = MailBuilder().with_status([Status.SEEN]).build_input_mail() - self.add_mail_to_inbox(input_mail) + yield self.add_mail_to_inbox(input_mail) - self.mark_many_as_unread([input_mail.ident]) - mail = self.get_mails_by_tag('inbox')[0] + yield self.mark_many_as_unread([input_mail.ident]) + mail = (yield self.get_mails_by_tag('inbox'))[0] self.assertNotIn('read', mail.status) + @defer.inlineCallbacks def test_mark_many_mails_as_unread(self): input_mail = MailBuilder().with_status([Status.SEEN]).build_input_mail() input_mail2 = MailBuilder().with_status([Status.SEEN]).build_input_mail() - self.add_mail_to_inbox(input_mail) - self.add_mail_to_inbox(input_mail2) + yield self.add_mail_to_inbox(input_mail) + yield self.add_mail_to_inbox(input_mail2) - self.mark_many_as_unread([input_mail.ident, input_mail2.ident]) + yield self.mark_many_as_unread([input_mail.ident, input_mail2.ident]) - mails = self.get_mails_by_tag('inbox') + mails = yield self.get_mails_by_tag('inbox') self.assertNotIn('read', mails[0].status) self.assertNotIn('read', mails[1].status) + @defer.inlineCallbacks def test_mark_many_mails_as_read(self): input_mail = MailBuilder().build_input_mail() input_mail2 = MailBuilder().build_input_mail() - self.add_mail_to_inbox(input_mail) - self.add_mail_to_inbox(input_mail2) + yield self.add_mail_to_inbox(input_mail) + yield self.add_mail_to_inbox(input_mail2) - mails = self.get_mails_by_tag('inbox') + mails = yield self.get_mails_by_tag('inbox') self.assertNotIn('read', mails[0].status) self.assertNotIn('read', mails[1].status) - response = self.mark_many_as_read([input_mail.ident, input_mail2.ident]) - self.assertEquals(200, response.code) + yield self.mark_many_as_read([input_mail.ident, input_mail2.ident]) - mails = self.get_mails_by_tag('inbox') + mails = yield self.get_mails_by_tag('inbox') self.assertIn('read', mails[0].status) self.assertIn('read', mails[1].status) + @defer.inlineCallbacks def test_mark_mixed_status_as_read(self): input_mail = MailBuilder().build_input_mail() input_mail2 = MailBuilder().with_status([Status.SEEN]).build_input_mail() - self.add_mail_to_inbox(input_mail) - self.add_mail_to_inbox(input_mail2) + yield self.add_mail_to_inbox(input_mail) + yield self.add_mail_to_inbox(input_mail2) - mails = self.get_mails_by_tag('inbox') + mails = yield self.get_mails_by_tag('inbox') read_mails = filter(lambda x: 'read' in x.status, mails) unread_mails = filter(lambda x: 'read' not in x.status, mails) self.assertEquals(1, len(unread_mails)) self.assertEquals(1, len(read_mails)) - response = self.mark_many_as_read([input_mail.ident, input_mail2.ident]) - self.assertEquals(200, response.code) + yield self.mark_many_as_read([input_mail.ident, input_mail2.ident]) - mails = self.get_mails_by_tag('inbox') + mails = yield self.get_mails_by_tag('inbox') self.assertIn('read', mails[0].status) self.assertIn('read', mails[1].status) diff --git a/service/test/support/integration/app_test_client.py b/service/test/support/integration/app_test_client.py index a76d4948..9acef1bd 100644 --- a/service/test/support/integration/app_test_client.py +++ b/service/test/support/integration/app_test_client.py @@ -47,8 +47,8 @@ class AppTestClient(object): ACCOUNT = 'test' MAIL_ADDRESS = 'test@pixelated.org' - def __init__(self): - self.start_client() + # def __init__(self): + # self.start_client() @defer.inlineCallbacks def start_client(self): @@ -210,7 +210,7 @@ class AppTestClient(object): def mark_many_as_unread(self, idents): res, req = self.post('/mails/unread', json.dumps({'idents': idents})) - return req + return res def mark_many_as_read(self, idents): res, req = self.post('/mails/read', json.dumps({'idents': idents})) |