Add flag to override URL unreachable state

- I refactored the Nagios helper a bit to integrate this functionality a bit simpler.
   Before we had distinct methods on the helper that added warn,crit,unko message, now
   there's a general method that takes an int as parameter.
   This way we avoid if-else structures for the new functionality.
This commit is contained in:
Markus Opolka
2024-03-18 10:18:04 +01:00
parent e96bba0eb8
commit 4fbb0c828a
2 changed files with 28 additions and 22 deletions

View File

@@ -84,10 +84,10 @@ class UtilTest(unittest.TestCase):
data = json.loads(jsondata)
nagios = NagiosHelper()
processor = JsonRuleProcessor(data, args)
nagios.append_warning(processor.checkWarning())
nagios.append_critical(processor.checkCritical())
nagios.append_message(WARNING_CODE, processor.checkWarning())
nagios.append_message(CRITICAL_CODE, processor.checkCritical())
nagios.append_metrics(processor.checkMetrics())
nagios.append_unknown(processor.checkUnknown())
nagios.append_message(UNKNOWN_CODE, processor.checkUnknown())
self.assertEqual(code, nagios.getCode())
def test_metrics(self):