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
4 changes: 4 additions & 0 deletions test/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ def offline_kg_client(mocker):
must be patched per-test."""
from fairgraph.client import KGClient

# Building the kg-core client fetches the IAM token endpoint from the KG, which
# fails if the KG is unreachable (e.g. during maintenance).
mocker.patch("kg_core.__communication.TokenHandler.define_endpoint")

client = KGClient(token="fake-token", allow_interactive=False)
# Skip the feature-detection fetch that the `migrated` property triggers.
client._migrated = True
Expand Down
5 changes: 4 additions & 1 deletion test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from uuid import uuid4
from typing import Optional

from requests.exceptions import SSLError
from requests.exceptions import RequestException, SSLError
from fairgraph.client import KGClient
from fairgraph.errors import AuthenticationError, AuthorizationError

Expand All @@ -20,6 +20,9 @@
pass
except SSLError:
no_kg_err_msg = "No KG connection - SSL certificate may have expired"
except RequestException:
# e.g. the KG is down for maintenance.
no_kg_err_msg = f"No KG connection - could not reach {kg_host}"
else:
try:
user_info = client.user_info()
Expand Down
Loading