summaryrefslogtreecommitdiff
path: root/src-py/test_rhizi_api.py
diff options
context:
space:
mode:
authorLV-426 <lv-426@taproot.org.il>2014-10-12 19:12:08 +0200
committerLV-426 <lv-426@taproot.org.il>2014-10-12 19:12:08 +0200
commit252ec42ffdd065b3db0d564a1b57b0a446a7fcd8 (patch)
treeb9086e0b9db4a389544172e10129c3e067d43df7 /src-py/test_rhizi_api.py
parentf76f673a8c4f9f3d69671fee8847ce066a85852d (diff)
misc
Diffstat (limited to 'src-py/test_rhizi_api.py')
-rw-r--r--src-py/test_rhizi_api.py25
1 files changed, 20 insertions, 5 deletions
diff --git a/src-py/test_rhizi_api.py b/src-py/test_rhizi_api.py
index 9749dfe9..c404edba 100644
--- a/src-py/test_rhizi_api.py
+++ b/src-py/test_rhizi_api.py
@@ -8,21 +8,31 @@ from rhizi_server import Config
from werkzeug.test import EnvironBuilder
from werkzeug.test import Client
+from db_controller import DB_Driver_Embedded
+
class TestRhiziAPI(unittest.TestCase):
def setUp(self):
- cfg = Config.init_from_file('res/etc/rhizi-server.conf')
- db_ctl = dbc.DB_Controller(cfg)
- rhizi_api.db_ctl = db_ctl
+ self.flush_db()
@classmethod
def setUpClass(self):
+ cfg = Config.init_from_file('res/etc/rhizi-server.conf')
+ self.db_ctl = dbc.DB_Controller(cfg)
+ rhizi_api.db_ctl = self.db_ctl
+
# TODO extract to superclass
log = logging.getLogger('rhizi')
log.setLevel(logging.DEBUG)
log_handler_c = logging.StreamHandler()
log.addHandler(log_handler_c)
+ def flush_db(self):
+ """
+ complete DB flush: remove all nodes & links
+ """
+ self.db_ctl.exec_cypher_query('match (n) optional match (n)-[r]-() delete n,r')
+
def test_add_node_set(self):
"""
add node set test
@@ -51,13 +61,15 @@ class TestRhiziAPI(unittest.TestCase):
self.assertEqual(None, rz_err)
self.assertEqual(0, len(rz_data))
- def test_load_node_existing(self):
+ def test_load_node_set_by_id_existing(self):
"""
loading an existing node test
"""
id_set = ['skill_00']
+ self.db_ctl.exec_cypher_query('create (s:Skill {id: \'skill_00\'} )')
+
with rhizi_api.webapp.test_client() as c:
- req = c.post('/load/node-set',
+ req = c.post('/load/node-set-by-id',
content_type='application/json',
data=json.dumps({ 'id_set': id_set}))
n_set = json.loads(req.data)['data']
@@ -65,5 +77,8 @@ class TestRhiziAPI(unittest.TestCase):
self.assertEqual(1, len(n_set))
self.assertEqual(n_set[0]['id'], id_set[0])
+ def test_load_node_set(self):
+ pass
+
if __name__ == "__main__":
unittest.main()