summaryrefslogtreecommitdiff
path: root/src-py/test_db_controller.py
diff options
context:
space:
mode:
authorLV-426 <lv-426@taproot.org.il>2014-10-06 17:29:59 +0300
committerLV-426 <lv-426@taproot.org.il>2014-10-06 17:31:59 +0300
commitc176cbea614d7e4d93f16c1479b97fd2641db12b (patch)
tree386feb62fb1f868f51ab0bdf86089542b8318532 /src-py/test_db_controller.py
parent8033e138410d3440ef0e76ed2baae515d4ec989f (diff)
use cypher query parameter place-holders:
- each attribute filter set in passed as a query parameter - avoid string encoding issues when attempting non-parameterized queries
Diffstat (limited to 'src-py/test_db_controller.py')
-rw-r--r--src-py/test_db_controller.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/src-py/test_db_controller.py b/src-py/test_db_controller.py
index 65f0231f..f64c47ce 100644
--- a/src-py/test_db_controller.py
+++ b/src-py/test_db_controller.py
@@ -22,18 +22,19 @@ class TestDBController(unittest.TestCase):
@classmethod
def setUpClass(self):
cfg = Config.init_from_file('res/etc/rhizi-server.conf')
- self.log = logging.getLogger('rhizi')
self.db_ctl = dbc.DB_Controller(cfg)
+ self.db_ctl.exec_op(dbc.DBO_add_node_set(self.n_map))
+ self.log = logging.getLogger('rhizi')
def setUp(self):
- self.db_ctl.exec_op(dbc.DBO_add_node_set(self.n_map))
+ pass
def test_load_node_set_by_attribute(self):
- filter_map = { 'name': ['Bob', 'Judo'],
+ filter_map = { 'name': ['Bob', u'Judo'],
'age': [128] }
n_set = self.db_ctl.exec_op(dbc.DBO_load_node_set_by_attribute(filter_map))
self.assertEqual(len(n_set), 1)
-
+
filter_map = { 'age': [128, 256, 404] }
n_set = self.db_ctl.exec_op(dbc.DBO_load_node_set_by_attribute(filter_map))
self.assertEqual(len(n_set), 2)
@@ -46,7 +47,8 @@ class TestDBController(unittest.TestCase):
"""
test node DB id life cycle
"""
- id_set = self.db_ctl.exec_op(dbc.DBO_add_node_set(self.n_map))
+ id_set = self.db_ctl.exec_op(dbc.DBO_add_node_set({'Person': [{'name': 'John Doe', 'id': 'jdoe_00'},
+ {'name': 'John Doe', 'id': 'jdoe_01'}]}))
n_set = self.db_ctl.exec_op(dbc.DBO_load_node_set_by_DB_id(id_set))
self.assertEqual(len(n_set), len(id_set), 'incorrect result size')