diff options
-rw-r--r-- | service/test/unit/adapter/mailstore/test_leap_mailstore.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/service/test/unit/adapter/mailstore/test_leap_mailstore.py b/service/test/unit/adapter/mailstore/test_leap_mailstore.py index 57dfa292..306d0b56 100644 --- a/service/test/unit/adapter/mailstore/test_leap_mailstore.py +++ b/service/test/unit/adapter/mailstore/test_leap_mailstore.py @@ -187,16 +187,9 @@ class TestLeapMailStore(TestCase): @defer.inlineCallbacks def test_add_mail(self): - {'multi': False, 'tags': [], 'deleted': False, 'mbox_uuid': '6e8e5a30_b784_43d4_a262_ad81962e5196', 'chash': 'DDE33BCB72DC69A0011CB1D4D4EF5A5F85E703C7C66C551AA51ED50334348A90', 'flags': [], 'seen': False, 'recent': False, 'type': 'flags', 'size': 566} - {'multi': False, 'tags': [], 'deleted': False, 'mbox_uuid': '', 'chash': 'DDE33BCB72DC69A0011CB1D4D4EF5A5F85E703C7C66C551AA51ED50334348A90', 'flags': [], 'seen': False, 'recent': False, 'type': 'flags', 'size': 566} - self._add_create_mail_mocks_to_soledad('mbox00000000') - mail = self._load_mail_from_file('mbox00000000') - when(self.soledad).list_indexes().thenReturn(defer.succeed(MAIL_INDEXES)).thenReturn(defer.succeed(MAIL_INDEXES)) - mbox = MailboxWrapper(doc_id=self.mbox_uuid, mbox='INBOX') - soledad_doc = SoledadDocument(self.mbox_uuid, json=json.dumps(mbox.serialize())) - when(self.soledad).get_from_index('by-type-and-mbox', 'mbox', 'INBOX').thenReturn(defer.succeed([soledad_doc])) + self._mock_get_mailbox('INBOX') store = LeapMailStore(self.soledad) @@ -204,6 +197,13 @@ class TestLeapMailStore(TestCase): self.assertEqual(self.mbox_uuid, mbx.doc_id) + def _mock_get_mailbox(self, mailbox_name): + when(self.soledad).list_indexes().thenReturn(defer.succeed(MAIL_INDEXES)).thenReturn( + defer.succeed(MAIL_INDEXES)) + mbox = MailboxWrapper(doc_id=self.mbox_uuid, mbox=mailbox_name) + soledad_doc = SoledadDocument(self.mbox_uuid, json=json.dumps(mbox.serialize())) + when(self.soledad).get_from_index('by-type-and-mbox', 'mbox', mailbox_name).thenReturn(defer.succeed([soledad_doc])) + def _add_mail_fixture_to_soledad(self, mail_file): mail = self._load_mail_from_file(mail_file) msg = self._convert_mail_to_leap_message(mail) |