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"])
def test_returns_check_status(self): hc = HealthCheckInfo( {"status": "ok", "checks": {"foo": {"status": "ok"}}} ) self.assertEqual(hc.check_statuses, ["foo - ok"])
def test_returns_no_checks(self): hc = HealthCheckInfo({"status": "ok"}) self.assertEqual(hc.check_statuses, [])
def test_fails_on_unknown_status_code(self): hc = HealthCheckInfo({"status": "devops"}) self.assertRaises(ValueError, lambda: hc.overall_status_code)
def test_reports_critical_status_code(self): hc = HealthCheckInfo({"status": "critical"}) self.assertEqual(hc.overall_status_code, 2)
def test_reports_ok_status_code(self): hc = HealthCheckInfo({"status": "ok"}) self.assertEqual(hc.overall_status_code, 0)
def test_raises_error_without_overall_status(self): self.assertRaises(ValueError, lambda: HealthCheckInfo({}))