summaryrefslogtreecommitdiff
path: root/service/test/unit
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2016-01-25 17:48:39 +0100
committerFolker Bernitt <fbernitt@thoughtworks.com>2016-01-25 17:48:39 +0100
commit48eea2554803fa18f745d0e9234d950b3da5dbcf (patch)
tree3e584764fd71f0acd287395a254ca974845ddff1 /service/test/unit
parent10117a698e5ffb1f74017129824b4c1b6a4ec73e (diff)
Fix: Ignore missing mail data error when creating search index
- Should fix accounts that can currently not log in because of mails where part of the docs are missing - Does only fix the symptoms
Diffstat (limited to 'service/test/unit')
-rw-r--r--service/test/unit/adapter/mailstore/test_leap_mailstore.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/service/test/unit/adapter/mailstore/test_leap_mailstore.py b/service/test/unit/adapter/mailstore/test_leap_mailstore.py
index 0945e0c4..bde4f59b 100644
--- a/service/test/unit/adapter/mailstore/test_leap_mailstore.py
+++ b/service/test/unit/adapter/mailstore/test_leap_mailstore.py
@@ -120,7 +120,7 @@ class TestLeapMailStore(TestCase):
try:
yield store.get_mails(['invalid'])
self.fail('Exception expected')
- except FirstError:
+ except Exception, e:
pass
@defer.inlineCallbacks
@@ -384,6 +384,17 @@ class TestLeapMailStore(TestCase):
self._assert_message_docs_created(expected_message, mail, only_mdoc_and_fdoc=True)
self._assert_mail_got_deleted(fdoc_id, mail_id)
+ @defer.inlineCallbacks
+ def test_all_mail_graceful_error_handling(self):
+ mail_id, fdoc_id = self._add_mail_fixture_to_soledad_from_file('mbox00000000')
+ when(self.soledad).get_from_index('by-type', 'meta').thenReturn(defer.succeed([self.doc_by_id[mail_id]]))
+ when(self.soledad).get_doc(self.doc_by_id[mail_id].content['cdocs'][0]).thenAnswer(lambda: defer.fail(Exception('fail loading attachment')))
+ store = LeapMailStore(self.soledad)
+
+ mails = yield store.all_mails(gracefully_ignore_errors=True)
+
+ self.assertEqual(0, len(mails))
+
def _assert_mail_got_deleted(self, fdoc_id, mail_id):
verify(self.soledad).delete_doc(self.doc_by_id[mail_id])
verify(self.soledad).delete_doc(self.doc_by_id[fdoc_id])