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

Added Go expected error types #592

Merged
merged 1 commit into from
Aug 30, 2023
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
16 changes: 16 additions & 0 deletions tests/stub/authorization/test_authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def _assert_is_retryable_authorization_error(self, error):
elif driver in ["java"]:
expected_type = \
"org.neo4j.driver.exceptions.SecurityRetryableException"
elif driver in ["go"]:
expected_type = "Neo4jError"
else:
self.fail("no error mapping is defined for %s driver" % driver)
if expected_type is not None:
Expand Down Expand Up @@ -104,6 +106,8 @@ def _assert_is_retryable_token_error(self, error):
elif driver in ["java"]:
expected_type = \
"org.neo4j.driver.exceptions.SecurityRetryableException"
elif driver == "go":
expected_type = "TokenExpiredError"
else:
self.fail("no error mapping is defined for %s driver" % driver)
if expected_type is not None:
Expand All @@ -130,6 +134,8 @@ def assert_is_unauthorized_error(self, error, retryable=False):
elif driver in ["java"]:
expected_type = \
"org.neo4j.driver.exceptions.AuthenticationException"
elif driver in ["go"]:
expected_type = "Neo4jError"
else:
self.fail("no error mapping is defined for %s driver" % driver)
if expected_type is not None:
Expand All @@ -148,6 +154,8 @@ def _assert_is_retryable_unauthorized_error(self, error):
elif driver in ["java"]:
expected_type = \
"org.neo4j.driver.exceptions.SecurityRetryableException"
elif driver in ["go"]:
expected_type = "Neo4jError"
else:
self.fail("no error mapping is defined for %s driver" % driver)
if expected_type is not None:
Expand All @@ -171,6 +179,8 @@ def assert_is_security_error(self, error, retryable=False):
expected_type = "OtherSecurityException"
elif driver in ["java"]:
expected_type = "org.neo4j.driver.exceptions.SecurityException"
elif driver in ["go"]:
expected_type = "Neo4jError"
else:
self.fail("no error mapping is defined for %s driver" % driver)
if expected_type is not None:
Expand All @@ -189,6 +199,8 @@ def _assert_is_retryable_security_error(self, error):
"org.neo4j.driver.exceptions.SecurityRetryableException"
elif driver in ["dotnet"]:
expected_type = "OtherSecurityException"
elif driver in ["go"]:
expected_type = "Neo4jError"
else:
self.fail("no error mapping is defined for %s driver" % driver)
if expected_type is not None:
Expand All @@ -210,6 +222,8 @@ def assert_is_transient_error(self, error):
expected_type = "org.neo4j.driver.exceptions.TransientException"
elif driver in ["dotnet"]:
expected_type = "DriverError"
elif driver in ["go"]:
expected_type = "Neo4jError"
else:
self.fail("no error mapping is defined for %s driver" % driver)
if expected_type is not None:
Expand All @@ -231,6 +245,8 @@ def assert_is_random_error(self, error):
expected_type = "org.neo4j.driver.exceptions.ClientException"
elif driver in ["dotnet"]:
expected_type = "ClientError"
elif driver in ["go"]:
expected_type = "Neo4jError"
else:
self.fail("no error mapping is defined for %s driver" % driver)
if expected_type is not None:
Expand Down