summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-02-26 12:59:37 -0400
committerKali Kaneko <kali@leap.se>2015-03-03 14:22:15 -0400
commit0270a05a1d5657a4b085003bd03ee2fbae25d00c (patch)
tree7eb6001490cc3dbdaf7dbefbdd1ab86f1201e35c
parent521aeb49e333da02a428b605e95876d13a772df5 (diff)
fix MessageTestCase: keep ref to inserted mbox uuid
-rw-r--r--mail/src/leap/mail/tests/test_mail.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/mail/src/leap/mail/tests/test_mail.py b/mail/src/leap/mail/tests/test_mail.py
index 7009b2f..24dcc8b 100644
--- a/mail/src/leap/mail/tests/test_mail.py
+++ b/mail/src/leap/mail/tests/test_mail.py
@@ -101,16 +101,21 @@ class MessageTestCase(SoledadTestMixin, CollectionMixin):
"""
Inserts and return a regular message, for tests.
"""
+ def insert_message(collection):
+ self._mbox_uuid = collection.mbox_uuid
+ return collection.add_msg(
+ raw, flags=self.msg_flags, tags=self.msg_tags,
+ date=self.internal_date)
+
raw = _get_raw_msg(multi=multi)
+
d = self.get_collection()
- d.addCallback(lambda col: col.add_msg(
- raw, flags=self.msg_flags, tags=self.msg_tags,
- date=self.internal_date))
+ d.addCallback(insert_message)
return d
def get_inserted_msg(self, multi=False):
d = self._do_insert_msg(multi=multi)
- d.addCallback(lambda _: self.get_collection())
+ d.addCallback(lambda _: self.get_collection(mbox_uuid=self._mbox_uuid))
d.addCallback(lambda col: col.get_message_by_uid(1))
return d
@@ -121,7 +126,7 @@ class MessageTestCase(SoledadTestMixin, CollectionMixin):
def _test_get_flags_cb(self, msg):
self.assertTrue(msg is not None)
- self.assertEquals(msg.get_flags(), self.msg_flags)
+ self.assertEquals(tuple(msg.get_flags()), self.msg_flags)
def test_get_internal_date(self):
d = self.get_inserted_msg()