summaryrefslogtreecommitdiff
path: root/service/test/integration
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-08-09 22:09:08 +0200
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-08-11 17:00:33 +0200
commit46ed5e1731fa0295a7f4b612457069db36bb8e64 (patch)
treef7b1d81e19f1e86d40c605910063e86feef6eb73 /service/test/integration
parent319e5e2ddd20444bb30f294a2fd08854dfaae494 (diff)
Worked on integration tests.
Diffstat (limited to 'service/test/integration')
-rw-r--r--service/test/integration/test_mark_as_read_unread.py33
1 files changed, 18 insertions, 15 deletions
diff --git a/service/test/integration/test_mark_as_read_unread.py b/service/test/integration/test_mark_as_read_unread.py
index b2249b54..48879e4a 100644
--- a/service/test/integration/test_mark_as_read_unread.py
+++ b/service/test/integration/test_mark_as_read_unread.py
@@ -25,35 +25,37 @@ class MarkAsReadUnreadTest(SoledadTestBase):
@defer.inlineCallbacks
def test_mark_single_as_read(self):
input_mail = MailBuilder().build_input_mail()
- yield self.add_mail_to_inbox(input_mail)
+ mail = yield self.add_mail_to_inbox(input_mail)
mails = yield self.get_mails_by_tag('inbox')
self.assertNotIn('read', mails[0].status)
- yield self.mark_many_as_read([input_mail.ident])
+ yield self.mark_many_as_read([mail.ident])
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()
- yield self.add_mail_to_inbox(input_mail)
+ input_mail = MailBuilder().build_input_mail()
+ mail = yield self.add_mail_to_inbox(input_mail)
+ yield self.mark_many_as_read([mail.ident])
- yield self.mark_many_as_unread([input_mail.ident])
- mail = (yield self.get_mails_by_tag('inbox'))[0]
+ yield self.mark_many_as_unread([mail.ident])
+ result = (yield self.get_mails_by_tag('inbox'))[0]
- self.assertNotIn('read', mail.status)
+ self.assertNotIn('read', result.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()
- yield self.add_mail_to_inbox(input_mail)
- yield self.add_mail_to_inbox(input_mail2)
+ mail1 = yield self.add_mail_to_inbox(input_mail)
+ mail2 = yield self.add_mail_to_inbox(input_mail2)
+ yield self.mark_many_as_read([mail1.ident, mail2.ident])
- yield self.mark_many_as_unread([input_mail.ident, input_mail2.ident])
+ yield self.mark_many_as_unread([mail1.ident, mail2.ident])
mails = yield self.get_mails_by_tag('inbox')
@@ -73,7 +75,7 @@ class MarkAsReadUnreadTest(SoledadTestBase):
self.assertNotIn('read', mails[0].status)
self.assertNotIn('read', mails[1].status)
- yield self.mark_many_as_read([input_mail.ident, input_mail2.ident])
+ yield self.mark_many_as_read([mails[0].ident, mails[1].ident])
mails = yield self.get_mails_by_tag('inbox')
@@ -82,11 +84,12 @@ class MarkAsReadUnreadTest(SoledadTestBase):
@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()
+ input_mail = MailBuilder().with_subject('first').build_input_mail()
+ input_mail2 = MailBuilder().with_subject('second').build_input_mail()
yield self.add_mail_to_inbox(input_mail)
- yield self.add_mail_to_inbox(input_mail2)
+ mail2 = yield self.add_mail_to_inbox(input_mail2)
+ yield self.mark_many_as_read([mail2.ident])
mails = yield self.get_mails_by_tag('inbox')
@@ -95,7 +98,7 @@ class MarkAsReadUnreadTest(SoledadTestBase):
self.assertEquals(1, len(unread_mails))
self.assertEquals(1, len(read_mails))
- yield self.mark_many_as_read([input_mail.ident, input_mail2.ident])
+ yield self.mark_many_as_read([mails[0].ident, mails[1].ident])
mails = yield self.get_mails_by_tag('inbox')