diff options
author | Josh Blum | 2013-06-01 17:18:53 -0700 |
---|---|---|
committer | Josh Blum | 2013-06-01 17:18:53 -0700 |
commit | bd7d2bff5fa5d23d2b7b5dfeec20c03cb97a4fb6 (patch) | |
tree | 8e63365ac10cc86e3297ad3aaa247f6a676bc6db /tests | |
parent | 618c0467762e3610f7e2afa48016183ff3a67060 (diff) | |
download | sandhi-bd7d2bff5fa5d23d2b7b5dfeec20c03cb97a4fb6.tar.gz sandhi-bd7d2bff5fa5d23d2b7b5dfeec20c03cb97a4fb6.tar.bz2 sandhi-bd7d2bff5fa5d23d2b7b5dfeec20c03cb97a4fb6.zip |
props: switched input args over to JSON
Diffstat (limited to 'tests')
-rw-r--r-- | tests/query_test.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/query_test.py b/tests/query_test.py index 5c37bad..1874eb2 100644 --- a/tests/query_test.py +++ b/tests/query_test.py @@ -44,19 +44,27 @@ class QueryTest(unittest.TestCase): self.assertEqual(vec_sink.get_vector(), (0, 9, 8, 7, 6)) - blocks_json = self.tb.query("<args><path>/blocks.json</path></args>") + #query the block list + blocks_json = self.tb.query('{"path": "/blocks.json"}') print blocks_json blocks_python = json.loads(blocks_json) print blocks_python self.assertEqual(len(blocks_python['blocks']), 2) - stats_json = self.tb.query("<args><path>/stats.json</path></args>") + #pick a block to query below: + block_id = blocks_python['blocks'].keys()[0] + + #query the stats + stats_json = self.tb.query(str('{"path": "/stats.json", "blocks": ["%s"]}'%block_id)) print stats_json stats_python = json.loads(stats_json) print stats_python self.assertTrue('tps' in stats_python) self.assertTrue('now' in stats_python) + #found the block we asked for + self.assertTrue(block_id in stats_python['blocks']) + def test_props(self): vec_source = VectorSource(numpy.uint32, [0, 9, 8, 7, 6]) vec_sink = VectorSink(numpy.uint32) @@ -64,7 +72,7 @@ class QueryTest(unittest.TestCase): self.tb.connect(vec_source, block, vec_sink) self.tb.run() - blocks_json = self.tb.query("<args><path>/blocks.json</path></args>") + blocks_json = self.tb.query('{"path": "/blocks.json"}') print blocks_json blocks_python = json.loads(blocks_json) print blocks_python |