Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test for bolt URI with routing context #371

Merged
merged 2 commits into from
Jan 20, 2022
Merged
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
40 changes: 20 additions & 20 deletions tests/stub/server_side_routing/test_server_side_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,25 @@ def test_direct_connection_with_url_params(self):
params = "region=china&policy=my_policy"
uri = "bolt://%s?%s" % (self._server.address, params)
self._start_server()
try:
with self.assertRaises(types.DriverError) as exc:
driver = Driver(self._backend, uri, self._auth, self._userAgent)
except types.DriverError as e:
if get_driver_name() in ["java"]:
self.assertEqual("java.lang.IllegalArgumentException",
e.errorType)
elif get_driver_name() in ["ruby"]:
self.assertEqual("ArgumentError", e.errorType)
except types.BackendError:
if get_driver_name() in ["javascript"]:
# TODO: this shouldn't be communicated as backend error
return

if get_driver_name() in ["java"]:
self.assertEqual("java.lang.IllegalArgumentException",
exc.exception.errorType)
self.assertIn(uri, exc.exception.msg)
elif get_driver_name() in ["ruby"]:
self.assertEqual("ArgumentError", exc.exception.errorType)
elif get_driver_name() in ["python"]:
self.assertEqual("<class 'ValueError'>", exc.exception.errorType)
self.assertIn(uri, exc.exception.msg)
elif get_driver_name() in ["javascript"]:
self.assertIn(uri, exc.exception.msg)
elif get_driver_name() in ["go"]:
self.assertIn("bolt", exc.exception.msg.lower())
self.assertIn("routing", exc.exception.msg.lower())
elif get_driver_name() in ["dotnet"]:
self.assertEqual("ArgumentError", exc.exception.errorType)
# not asserting on the whole URI because the backend normalizes it.
self.assertIn(params, exc.exception.msg)
else:
# Python driver
session = driver.session("w", fetch_size=1000)
session.run("RETURN 1 AS n")
# Otherwise the script will not fail when the protocol is not
# present (on backends where run is lazily evaluated)
session.close()
self._server.done()
driver.close()
self.fail("no error mapping is defined for %s driver" % driver)