コード例 #1
0
ファイル: test_tasks.py プロジェクト: patzi/paperless-ng
 def test_sanity_check(self, m):
     m.return_value = []
     tasks.sanity_check()
     m.assert_called_once()
     m.reset_mock()
     m.return_value = [SanityError("")]
     self.assertRaises(SanityFailedError, tasks.sanity_check)
     m.assert_called_once()
コード例 #2
0
 def test_sanity_check_info(self, m):
     messages = SanityCheckMessages()
     messages.info("Some info")
     m.return_value = messages
     self.assertEqual(tasks.sanity_check(),
                      "Sanity check exited with infos. See log.")
     m.assert_called_once()
コード例 #3
0
 def test_sanity_check_warning(self, m):
     messages = SanityCheckMessages()
     messages.warning("Some warning")
     m.return_value = messages
     self.assertEqual(tasks.sanity_check(),
                      "Sanity check exited with warnings. See log.")
     m.assert_called_once()
コード例 #4
0
 def test_sanity_check_success(self, m):
     m.return_value = SanityCheckMessages()
     self.assertEqual(tasks.sanity_check(), "No issues detected.")
     m.assert_called_once()