Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 10 additions & 18 deletions tests/stub/authorization/test_authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,17 @@ def _fail_on_begin_using_tx_run(self, error, error_assertion):
vars_=vars_)

session = driver.session("r", database=self.get_db())
with self.assertRaises(types.DriverError) as exc:

# TODO: remove block when all drivers behave the same way
if get_driver_name() in ["javascript", "go"]:
tx = session.begin_transaction()
# TODO: remove block when all drivers behave the same way
if get_driver_name() in ["javascript", "go"]:
with self.assertRaises(types.DriverError) as exc:
tx.run("cypher").next()
else:
# this is what all drivers should do
with self.assertRaises(types.DriverError) as exc:
session.begin_transaction()
error_assertion(exc.exception)
if get_driver_name() in ["go"]:
with self.assertRaises(types.DriverError):
# session will throw upon closure if there is a pending tx
# tx will throw the last seen error upon closure
tx.close()
session.close()
driver.close()

Expand Down Expand Up @@ -244,11 +244,7 @@ def _fail_on_run_using_tx_run(self, error, error_assertion):
result.consume()

error_assertion(exc.exception)
if get_driver_name() in ["go"]:
# session will throw upon closure if there is a pending tx
# tx will throw the last seen error upon closure
with self.assertRaises(types.DriverError):
tx.close()
tx.rollback()
session.close()
driver.close()

Expand Down Expand Up @@ -283,11 +279,7 @@ def _fail_on_pull_using_tx_run(self, error, error_assertion):
result = tx.run("RETURN 1 as n")
result.next()
error_assertion(exc.exception)
if get_driver_name() in ["go"]:
# session will throw upon closure if there is a pending tx
# tx will throw the last seen error upon closure
with self.assertRaises(types.DriverError):
tx.close()
tx.rollback()
session.close()
driver.close()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,8 @@ def test_timeout_unmanaged_tx(self):
# has async iterator api
if get_driver_name() in ["javascript", "dotnet"]:
result.next()
# TODO remove once Go driver does not raise the last seen error upon
# tx closure
if get_driver_name() in ["go"]:
with self.assertRaises(types.DriverError) as exc:
tx.close()
# TODO Remove when explicit rollback requirement is removed
if get_driver_name() in ["java", "ruby"]:
if get_driver_name() in ["java", "ruby", "go"]:
tx.rollback()

tx = self._session.begin_transaction()
Expand Down Expand Up @@ -138,12 +133,6 @@ def test_timeout_unmanaged_tx_should_fail_subsequent_usage_after_timeout(
if get_driver_name() in ["javascript", "dotnet"]:
result.next()

# TODO remove once Go driver does not raise the last seen error upon
# tx closure
if get_driver_name() in ["go"]:
with self.assertRaises(types.DriverError):
tx.close()

# TODO Remove when explicit rollback requirement is removed
if get_driver_name() in ["java", "ruby"]:
tx.rollback()
Expand Down
13 changes: 12 additions & 1 deletion tests/stub/iteration/test_result_peek.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,21 @@ def _assert_connection_error(self, error):
if driver in ["python"]:
self.assertEqual("<class 'neo4j.exceptions.ServiceUnavailable'>",
error.errorType)
elif driver in ["java"]:
self.assertEqual(
"org.neo4j.driver.exceptions.ServiceUnavailableException",
error.errorType
)
elif driver in ["ruby"]:
self.assertEqual(
"Neo4j::Driver::Exceptions::ServiceUnavailableException",
error.errorType)
error.errorType
)
elif driver in ["go"]:
self.assertEqual(
"ConnectivityError",
error.errorType
)
else:
self.fail("no error mapping is defined for %s driver" % driver)

Expand Down