Exemplo n.º 1
0
    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 test_all_mails(self):
        first_mdoc_id, _ = self._add_mail_fixture_to_soledad_from_file('mbox00000000')
        second_mdoc_id, _ = self._add_mail_fixture_to_soledad_from_file('mbox00000001')
        when(self.soledad).get_from_index('by-type', 'meta').thenReturn(defer.succeed([self.doc_by_id[first_mdoc_id], self.doc_by_id[second_mdoc_id]]))

        store = LeapMailStore(self.soledad)

        mails = yield store.all_mails()

        self.assertIsNotNone(mails)
        self.assertEqual(2, len(mails))
        self.assertEqual('Itaque consequatur repellendus provident sunt quia.', mails[0].subject)
        self.assertEqual('Error illum dignissimos autem eos aspernatur.', mails[1].subject)
Exemplo n.º 3
0
    def test_all_mails(self):
        first_mdoc_id, _ = self._add_mail_fixture_to_soledad_from_file('mbox00000000')
        second_mdoc_id, _ = self._add_mail_fixture_to_soledad_from_file('mbox00000001')
        when(self.soledad).get_from_index('by-type', 'meta').thenReturn(defer.succeed([self.doc_by_id[first_mdoc_id], self.doc_by_id[second_mdoc_id]]))

        store = LeapMailStore(self.soledad)

        mails = yield store.all_mails()

        self.assertIsNotNone(mails)
        self.assertEqual(2, len(mails))
        self.assertEqual('Itaque consequatur repellendus provident sunt quia.', mails[0].subject)
        self.assertEqual('Error illum dignissimos autem eos aspernatur.', mails[1].subject)