From 27c710b2ea6f5724cf75fa6ba55bf2e9cad4a21b Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Fri, 22 Mar 2024 15:45:25 +0100 Subject: [PATCH] Extend tests for array syntax --- test/test_check_http_json.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/test_check_http_json.py b/test/test_check_http_json.py index 659e77c..73904c7 100644 --- a/test/test_check_http_json.py +++ b/test/test_check_http_json.py @@ -110,6 +110,14 @@ def test_unknown(self): self.check_data(RulesHelper().dash_U(['metric,0']), '{"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): self.check_data(RulesHelper().dash_e(['nothere']), '{"metric": 5}', WARNING_CODE)