From bd7d2bff5fa5d23d2b7b5dfeec20c03cb97a4fb6 Mon Sep 17 00:00:00 2001
From: Josh Blum
Date: Sat, 1 Jun 2013 17:18:53 -0700
Subject: props: switched input args over to JSON
---
tests/query_test.py | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
(limited to 'tests/query_test.py')
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("/blocks.json")
+ #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("/stats.json")
+ #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("/blocks.json")
+ blocks_json = self.tb.query('{"path": "/blocks.json"}')
print blocks_json
blocks_python = json.loads(blocks_json)
print blocks_python
--
cgit