mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-05 00:13:01 +00:00
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:
1 parent
5a503e9b3c
commit
26bd4e2a3f
1 file changed
+10
@@ -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
|
||||
|
||||
Reference in new issue
Block a user