From ffc10a053181a4cb1212a4237abd9cae132457e4 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 25 Feb 2025 11:53:44 -0800 Subject: [PATCH] Coverage --- src/documents/tests/test_tasks.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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()