mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-05 07:41:39 +00:00
fix(tests): stabilize xai env and provider parity
This commit is contained in:
parent
73df329214
commit
1a82b7a1ff
3 changed files with 50 additions and 11 deletions
|
|
@ -58,6 +58,33 @@ class TestProviderSelectionGate:
|
|||
finally:
|
||||
importlib.reload(tt)
|
||||
|
||||
def test_xai_resolver_import_after_config_env_patch_uses_restored_dotenv_loader(self):
|
||||
"""xAI HTTP auth must not cache a temporarily patched env helper."""
|
||||
import importlib
|
||||
import hermes_cli.config as config_mod
|
||||
from tools import xai_http
|
||||
|
||||
with pytest.MonkeyPatch.context() as mp:
|
||||
mp.setattr(config_mod, "get_env_value", lambda name, default=None: "")
|
||||
xai_http = importlib.reload(xai_http)
|
||||
|
||||
try:
|
||||
with patch(
|
||||
"hermes_cli.runtime_provider.resolve_runtime_provider",
|
||||
side_effect=RuntimeError("no oauth"),
|
||||
), patch(
|
||||
"hermes_cli.auth.resolve_xai_oauth_runtime_credentials",
|
||||
return_value={},
|
||||
), patch(
|
||||
"hermes_cli.config.load_env",
|
||||
return_value={"XAI_API_KEY": "dotenv-secret"},
|
||||
):
|
||||
creds = xai_http.resolve_xai_http_credentials()
|
||||
finally:
|
||||
importlib.reload(xai_http)
|
||||
|
||||
assert creds["api_key"] == "dotenv-secret"
|
||||
|
||||
def test_explicit_groq_sees_dotenv(self):
|
||||
from tools import transcription_tools as tt
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue