Skip to content

Commit 23cc363

Browse files
committed
Test to show correct behaviour for using a closed transaction.
1 parent 57daeea commit 23cc363

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

test/test_session.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
from neo4j.v1 import \
2727
GraphDatabase, basic_auth, READ_ACCESS, WRITE_ACCESS, \
28-
CypherError, SessionError, \
28+
CypherError, SessionError, TransactionError, \
2929
Node, Relationship, Path
3030
from neo4j.v1.types import Record
3131

@@ -692,3 +692,20 @@ def test_errors_on_run(self):
692692
def test_errors_on_begin_transaction(self):
693693
with self.assertRaises(SessionError):
694694
self.session.begin_transaction()
695+
696+
697+
class TransactionCommittedTestCase(ServerTestCase):
698+
699+
def setUp(self):
700+
self.driver = GraphDatabase.driver(BOLT_URI, auth=AUTH_TOKEN)
701+
self.session = self.driver.session()
702+
self.transaction = self.session.begin_transaction()
703+
self.transaction.run("RETURN 1")
704+
self.transaction.commit()
705+
706+
def tearDown(self):
707+
self.driver.close()
708+
709+
def test_errors_on_run(self):
710+
with self.assertRaises(TransactionError):
711+
self.transaction.run("RETURN 1")

0 commit comments

Comments
 (0)