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
commitc49b378efdf61b7f06f3596e6ecf4ac0d27128fa (patch)
tree90fa25afb1d0475d6ff75b497e15650aa2dcb133
parente8ca689b9eaf4ea39f15ea0ff172dda4dd29a9b2 (diff)
fix MessageTestCase: keep ref to inserted mbox uuid
-rw-r--r--src/leap/mail/tests/test_mail.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/leap/mail/tests/test_mail.py b/src/leap/mail/tests/test_mail.py
index 7009b2f..24dcc8b 100644
--- a/src/leap/mail/tests/test_mail.py
+++ b/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()