Keep the GitHub loader tests off the network

With GITHUB_ACCESS_TOKEN set in the environment, load_data checked the
repository's visibility against the real GitHub API. The tests now clear
the instance token unless they set one.
This commit is contained in:
arc53-machine committed 2026-09-29 15:09:50 +01:00
1 parent 5a503e9b3c
commit 26bd4e2a3f
1 file changed
+10
+10
View File
@@ -6,6 +6,16 @@ import requests
from docsgpt.parser.remote.github_loader import GitHubLoader
@pytest.fixture(autouse=True)
def _no_instance_token(monkeypatch):
"""No ``GITHUB_ACCESS_TOKEN`` from the environment: with one, ``load_data``
checks the repository's visibility against the real GitHub API. Tests that
need the instance token set it themselves."""
from docsgpt.core.settings import settings
monkeypatch.setattr(settings, "GITHUB_ACCESS_TOKEN", None)
def make_response(json_data=None, status_code=200, raise_error=None):
resp = MagicMock()
resp.status_code = status_code