diff --git a/src/documents/tests/test_tasks.py b/src/documents/tests/test_tasks.py index 0f9f8511f..348eb0db5 100644 --- a/src/documents/tests/test_tasks.py +++ b/src/documents/tests/test_tasks.py @@ -118,6 +118,19 @@ class TestSanityCheck(DirectoriesMixin, TestCase): self.assertRaises(SanityCheckFailedException, tasks.sanity_check) m.assert_called_once() + @mock.patch("documents.tasks.sanity_checker.check_sanity") + def test_sanity_check_error_no_raise(self, m): + messages = SanityCheckMessages() + messages.error(None, "Some error") + m.return_value = messages + # No exception should be raised + result = tasks.sanity_check(raise_on_error=False) + self.assertEqual( + result, + "Sanity check exited with errors. See log.", + ) + m.assert_called_once() + @mock.patch("documents.tasks.sanity_checker.check_sanity") def test_sanity_check_warning(self, m): messages = SanityCheckMessages()