Merge pull request #85 from drewkerrigan/extend-tests

Extend tests for array syntax
This commit is contained in:
Markus Opolka 2024-03-22 15:52:10 +01:00 committed by GitHub
commit ce9c5fdada
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -110,6 +110,14 @@ class UtilTest(unittest.TestCase):
self.check_data(RulesHelper().dash_U(['metric,0']), self.check_data(RulesHelper().dash_U(['metric,0']),
'{"metric": 3}', UNKNOWN_CODE) '{"metric": 3}', UNKNOWN_CODE)
def test_array(self):
self.check_data(RulesHelper().dash_q(['foo(0),bar']),
'{"foo": ["bar"]}', OK_CODE)
self.check_data(RulesHelper().dash_q(['foo(0),foo']),
'{"foo": ["bar"]}', WARNING_CODE)
self.check_data(RulesHelper().dash_Q(['foo(1),bar']),
'{"foo": ["bar"]}', CRITICAL_CODE)
def test_exists(self): def test_exists(self):
self.check_data(RulesHelper().dash_e(['nothere']), self.check_data(RulesHelper().dash_e(['nothere']),
'{"metric": 5}', WARNING_CODE) '{"metric": 5}', WARNING_CODE)