From cf0583059bbcecbb655924afdbf16d51122703b2 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Thu, 20 Sep 2012 14:18:50 -0400 Subject: testsuite: Fixed Probes JSON tests --- .../Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'testsuite') diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py index 27b48fce4..4b020dcff 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py @@ -69,7 +69,6 @@ class TestProbeData(Bcfg2TestCase): self.assertIsNotNone(data.xdata) self.assertIsNotNone(data.xdata.find("test2")) - @skipUnless(has_json, "JSON libraries not found, skipping JSON tests") def test_json(self): jdata = json.dumps(test_data) data = ProbeData(jdata) @@ -221,10 +220,9 @@ text """) rv["bar.example.com"] = ClientProbeDataSet(timestamp=time.time()) rv["bar.example.com"]["empty"] = ProbeData("") + rv["bar.example.com"]["json"] = ProbeData(json.dumps(test_data)) if has_yaml: rv["bar.example.com"]["yaml"] = ProbeData(yaml.dump(test_data)) - if has_json: - rv["bar.example.com"]["json"] = ProbeData(json.dumps(test_data)) return rv def get_test_cgroups(self): @@ -333,16 +331,15 @@ text self.assertIsNotNone(empty) self.assertIsNotNone(empty.get("value")) self.assertEqual(empty.get("value"), "") + jdata = bardata.find("Probe[@name='json']") + self.assertIsNotNone(jdata) + self.assertIsNotNone(jdata.get("value")) + self.assertItemsEqual(test_data, json.loads(jdata.get("value"))) if has_yaml: ydata = bardata.find("Probe[@name='yaml']") self.assertIsNotNone(ydata) self.assertIsNotNone(ydata.get("value")) self.assertItemsEqual(test_data, yaml.load(ydata.get("value"))) - if has_json: - jdata = bardata.find("Probe[@name='json']") - self.assertIsNotNone(jdata) - self.assertIsNotNone(jdata.get("value")) - self.assertItemsEqual(test_data, json.loads(jdata.get("value"))) @skipUnless(has_django, "Django not found, skipping") def test__write_data_db(self): -- cgit v1.2.3-1-g7c22