From c49b378efdf61b7f06f3596e6ecf4ac0d27128fa Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 26 Feb 2015 12:59:37 -0400 Subject: fix MessageTestCase: keep ref to inserted mbox uuid --- src/leap/mail/tests/test_mail.py | 15 ++++++++++----- 1 file 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() -- cgit v1.2.3