Skip to content

Skip _db prefix on /_open/auth #374

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

Merged
merged 3 commits into from
Jul 9, 2025
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
20 changes: 16 additions & 4 deletions arango/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,22 @@ def prep_response(self, resp: Response, deserialize: bool = True) -> Response:
return resp

def process_request(
self, host_index: int, request: Request, auth: Optional[Tuple[str, str]] = None
self,
host_index: int,
request: Request,
auth: Optional[Tuple[str, str]] = None,
skip_db_prefix: bool = False,
) -> Response:
"""Execute a request until a valid response has been returned.

:param host_index: The index of the first host to try
:type host_index: int
:param request: HTTP request.
:type request: arango.request.Request
:param auth: HTTP basic authentication tuple (username, password).
:type auth: tuple[str, str] | None
:param skip_db_prefix: Skip the database prefix in the URL.
:type skip_db_prefix: bool
:return: HTTP response.
:rtype: arango.response.Response
"""
Expand All @@ -152,11 +160,16 @@ def process_request(
request.headers["accept-encoding"] = self._response_compression

while tries < self._host_resolver.max_tries:
if skip_db_prefix:
url = self._hosts[host_index] + request.endpoint
else:
url = self._url_prefixes[host_index] + request.endpoint

try:
resp = self._http.send_request(
session=self._sessions[host_index],
method=request.method,
url=self._url_prefixes[host_index] + request.endpoint,
url=url,
params=request.params,
data=data,
headers=request.headers,
Expand All @@ -165,7 +178,6 @@ def process_request(

return self.prep_response(resp, request.deserialize)
except ConnectionError:
url = self._url_prefixes[host_index] + request.endpoint
logging.debug(f"ConnectionError: {url}")

if len(indexes_to_filter) == self._host_resolver.host_count - 1:
Expand Down Expand Up @@ -425,7 +437,7 @@ def refresh_token(self) -> None:

host_index = self._host_resolver.get_host_index()

resp = self.process_request(host_index, request)
resp = self.process_request(host_index, request, skip_db_prefix=True)

if not resp.is_success:
raise JWTAuthError(resp, request)
Expand Down
2 changes: 1 addition & 1 deletion starter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Usage:
# ./starter.sh [single|cluster] [community|enterprise] [version]
# Example:
# ./starter.sh cluster enterprise 3.12.1
# ./starter.sh cluster enterprise 3.12.5

setup="${1:-single}"
license="${2:-community}"
Expand Down
11 changes: 8 additions & 3 deletions tests/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,18 +439,23 @@ def test_database_utf8(sys_db, special_db_names):
assert sys_db.delete_database(name)


def test_license(sys_db, enterprise):
def test_license(sys_db, enterprise, db_version):
license = sys_db.license()
assert isinstance(license, dict)

if enterprise:
assert set(license.keys()) == {
if db_version >= version.parse("3.12.5"):
expected_keys = {"diskUsage", "upgrading"}
else:
expected_keys = {
"upgrading",
"features",
"license",
"version",
"status",
}

if enterprise:
assert set(license.keys()) == expected_keys
else:
assert license == {"license": "none"}
with pytest.raises(ServerLicenseSetError):
Expand Down
Loading