diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-31 14:33:42 +0200 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-31 14:37:38 +0200 |
commit | fd8d3cc1da5079c931a7ad897bff047509f27a40 (patch) | |
tree | 5a198babecf9f7ad5abc6d0b4cff3227eb2a38a4 /service/test | |
parent | 97b50f5b886928c70edcbcea149ced10f7065f19 (diff) |
Ensure MailboxIndexerListener does not let exceptions escape.
- Issue #445
Diffstat (limited to 'service/test')
-rw-r--r-- | service/test/unit/adapter/test_mailbox_indexer_listener.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/service/test/unit/adapter/test_mailbox_indexer_listener.py b/service/test/unit/adapter/test_mailbox_indexer_listener.py index d107c68a..9ad3c94d 100644 --- a/service/test/unit/adapter/test_mailbox_indexer_listener.py +++ b/service/test/unit/adapter/test_mailbox_indexer_listener.py @@ -13,10 +13,13 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see <http://www.gnu.org/licenses/>. -import unittest +from twisted.trial import unittest -from mockito import mock, when, verify +from mockito import mock, when, verify, any as ANY from pixelated.adapter.listeners.mailbox_indexer_listener import MailboxIndexerListener +from twisted.internet import defer + +from pixelated.adapter.listeners.mailbox_indexer_listener import logger class MailboxListenerTest(unittest.TestCase): @@ -52,3 +55,12 @@ class MailboxListenerTest(unittest.TestCase): verify(self.mail_store, times=1).get_mails('INBOX') self.assertIn({'missing_ident'}, self.mail_store.used_arguments) + + @defer.inlineCallbacks + def test_catches_exceptions_to_not_break_other_listeners(self): + when(logger).error(ANY()).thenReturn(None) + listener = MailboxIndexerListener('INBOX', self.mail_store) + + yield listener.newMessages(1, 1) + + verify(logger).error(ANY()) |