From 9b89717dfc286af0127108b221630f9c1d054971 Mon Sep 17 00:00:00 2001 From: LV-426 Date: Mon, 27 Oct 2014 12:31:48 +0200 Subject: DBO_rm_node_set & test --- src-py/test_db_controller.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src-py/test_db_controller.py') diff --git a/src-py/test_db_controller.py b/src-py/test_db_controller.py index 54952df1..4b17ad3c 100644 --- a/src-py/test_db_controller.py +++ b/src-py/test_db_controller.py @@ -259,6 +259,37 @@ class TestDBController(unittest.TestCase): op = dbc.DBO_attr_diff_commit(attr_diff) n_map = self.db_ctl.exec_op(op) + def test_rm_node_set(self): + n_0_id = rand_id() + n_1_id = rand_id() + n_2_id = rand_id() + n_3_id = rand_id() + n_T = 'T_test_rm_node_set' + + n_set = [{'__type': n_T, 'id': n_0_id }, + {'__type': n_T, 'id': n_1_id }, + {'__type': n_T, 'id': n_2_id }, + {'__type': n_T, 'id': n_3_id }] + l_set = [{'__type': n_T, '__src': n_2_id, '__dst': n_2_id}, + {'__type': n_T, '__src': n_2_id, '__dst': n_3_id}] + + topo_diff = Topo_Diff(node_set_add=n_set, + link_set_add=l_set) + + op = dbc.DBO_topo_diff_commit(topo_diff) + self.db_ctl.exec_op(op) + + op = dbc.DBO_rm_node_set([n_0_id, n_1_id]) + self.db_ctl.exec_op(op) + + op = dbc.DBO_rm_node_set([n_2_id, n_3_id], rm_links=True) + self.db_ctl.exec_op(op) + + # assert all deleted + op = dbc.DBO_match_node_id_set(filter_type=n_T) + id_set = self.db_ctl.exec_op(op) + self.assertEqual(len(id_set), 0) + def tearDown(self): pass if __name__ == "__main__": -- cgit v1.3.1