Пример #1
0
 def test_includes_check_message(self):
     hc = HealthCheckInfo(
         {
             "status": "warning",
             "checks": {
                 "foo": {"status": "ok", "message": "All 12 foos look good"}
             }
         }
     )
     self.assertEqual(hc.check_statuses,
                      ["foo - ok - All 12 foos look good"])
Пример #2
0
 def test_returns_check_status(self):
     hc = HealthCheckInfo(
         {"status": "ok", "checks": {"foo": {"status": "ok"}}}
     )
     self.assertEqual(hc.check_statuses, ["foo - ok"])
Пример #3
0
 def test_returns_no_checks(self):
     hc = HealthCheckInfo({"status": "ok"})
     self.assertEqual(hc.check_statuses, [])
Пример #4
0
 def test_fails_on_unknown_status_code(self):
     hc = HealthCheckInfo({"status": "devops"})
     self.assertRaises(ValueError, lambda: hc.overall_status_code)
Пример #5
0
 def test_reports_critical_status_code(self):
     hc = HealthCheckInfo({"status": "critical"})
     self.assertEqual(hc.overall_status_code, 2)
Пример #6
0
 def test_reports_ok_status_code(self):
     hc = HealthCheckInfo({"status": "ok"})
     self.assertEqual(hc.overall_status_code, 0)
Пример #7
0
 def test_raises_error_without_overall_status(self):
     self.assertRaises(ValueError, lambda: HealthCheckInfo({}))