diff options
| author | LV-426 <lv-426@taproot.org.il> | 2014-10-12 13:46:49 +0200 |
|---|---|---|
| committer | LV-426 <lv-426@taproot.org.il> | 2014-10-12 13:46:49 +0200 |
| commit | f917586c635d099891708ae6e1ca4796b28a53e8 (patch) | |
| tree | fc90b31a68d4f8274b75ddbd2bd2a713b01cd854 | |
| parent | abdd6499319a4857e2653697e8398fe13b141c39 (diff) | |
test_partial_query_set_execution_success
| -rw-r--r-- | src-py/test_db_controller.py | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src-py/test_db_controller.py b/src-py/test_db_controller.py index f7092e6d..e09548bb 100644 --- a/src-py/test_db_controller.py +++ b/src-py/test_db_controller.py @@ -66,7 +66,33 @@ class TestDBController(unittest.TestCase): 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') - def test_load_node_set_by_DB_id(self): pass + def test_load_node_set_by_DB_id(self): pass # TODO + + def test_partial_query_set_execution_success(self): + """ + test: + - statement execution stops at first invalid statement + - assert create statement with result data does not actually persist in DB + + From the REST API doc: 'If any errors occur while executing statements, + the server will roll back the transaction.' + """ + n_id = 'test_partial_query_set_execution_success' + + op = dbc.DB_op() + op.add_statement("create (n:Person {id: '%s'}) return n" % (n_id), {}) # valid statement + op.add_statement("match (n) return n", {}) # valid statement + op.add_statement("non-valid statement #1", {}) + op.add_statement("non-valid statement #2", {}) + + self.db_ctl.exec_op(op) + + self.assertEqual(len(op.result_set), 2) + self.assertEqual(len(op.error_set), 1) + + # assert node creation did not persist + n_set = self.db_ctl.exec_op(dbc.DBO_load_node_set_by_id_attribute([n_id])) + self.assertEqual(len(n_set), 0) def tearDown(self): pass |
