From 107aecad487df3c7d4d53a89e819ce1a60a0c3ab Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Sat, 31 Jul 2021 17:14:52 +0300 Subject: [PATCH] Better testing of PerfData. I wouldn't call it perfect or thorough, but it's a little better than before. --- tests/test_nagios.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/test_nagios.py b/tests/test_nagios.py index 9884390..ccffcc1 100644 --- a/tests/test_nagios.py +++ b/tests/test_nagios.py @@ -113,4 +113,13 @@ def test_output_parsing(output): @pytest.mark.parametrize("line", PERF_DATA) def test_data_perf(line): """Test parsing of perfdata.""" - nagios.PerfData(line) + pd = nagios.PerfData(line) + assert isinstance(pd.name, str) + assert len(pd.name) > 0 + assert isinstance(pd.value, float) + assert isinstance(pd.unit, str) + assert len(pd.unit) > 0 + assert isinstance(pd.warning, (float, type(None))) + assert isinstance(pd.critical, (float, type(None))) + assert isinstance(pd.min, (float, type(None))) + assert isinstance(pd.max, (float, type(None))) -- GitLab