mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(cli): validate user-defined providers consistently
This commit is contained in:
parent
3aa1a41e88
commit
ccc8fccf77
4 changed files with 135 additions and 13 deletions
|
|
@ -339,6 +339,41 @@ def test_select_provider_and_model_warns_if_named_custom_provider_disappears(
|
|||
assert "selected saved custom provider is no longer available" in out
|
||||
|
||||
|
||||
def test_select_provider_and_model_accepts_named_provider_from_providers_section(
|
||||
tmp_path, monkeypatch, capsys
|
||||
):
|
||||
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
|
||||
_clear_provider_env(monkeypatch)
|
||||
|
||||
cfg = load_config()
|
||||
cfg["model"] = {
|
||||
"provider": "volcengine-plan",
|
||||
"default": "doubao-seed-2.0-code",
|
||||
}
|
||||
cfg["providers"] = {
|
||||
"volcengine-plan": {
|
||||
"name": "volcengine-plan",
|
||||
"base_url": "https://ark.cn-beijing.volces.com/api/coding/v3",
|
||||
"default_model": "doubao-seed-2.0-code",
|
||||
"models": {"doubao-seed-2.0-code": {}},
|
||||
}
|
||||
}
|
||||
save_config(cfg)
|
||||
|
||||
monkeypatch.setattr(
|
||||
"hermes_cli.main._prompt_provider_choice",
|
||||
lambda choices, default=0: len(choices) - 1,
|
||||
)
|
||||
|
||||
from hermes_cli.main import select_provider_and_model
|
||||
|
||||
select_provider_and_model()
|
||||
|
||||
out = capsys.readouterr().out
|
||||
assert "Warning: Unknown provider 'volcengine-plan'" not in out
|
||||
assert "Active provider: volcengine-plan" in out
|
||||
|
||||
|
||||
def test_codex_setup_uses_runtime_access_token_for_live_model_list(tmp_path, monkeypatch):
|
||||
"""Codex model list fetching uses the runtime access token."""
|
||||
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue