The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(dashboard): trim the profile model-scope tests to two invariants on the reported path
teknium1e8f8970bbec9
diff --git a/tests/hermes_cli/test_web_profiles_model_scope.py b/tests/hermes_cli/test_web_profiles_model_scope.pyindex 174019d2ff1..ca06591192a 100644--- a/tests/hermes_cli/test_web_profiles_model_scope.py+++ b/tests/hermes_cli/test_web_profiles_model_scope.py@@ -17,10 +17,11 @@ from fastapi.testclient import TestClient # noqa: E402from agent import secret_scope # noqa: E402ACME_YAML = (- "providers:\n"- " acme:\n"+ "custom_providers:\n"+ " - name: acme\n"" base_url: https://api.acme.test/v1\n"" key_env: ACME_RELAY_KEY\n"+ " models: [acme/mini]\n")@@ -47,35 +48,15 @@ def homes(tmp_path, monkeypatch):@pytest.fixture()def probe(monkeypatch):- """Capture the credential ``switch_model`` resolved, without network round-trips."""+ """Capture the credential the real ``custom_providers`` resolution handed to the network+ validation step (the only stubbed piece); ``key_env`` is read by the production path."""captured = {}- def _fake_runtime(- requested,- explicit_api_key=None,- explicit_base_url=None,- target_model=None,- **kw,- ):- captured.setdefault("api_key", explicit_api_key)- return {- "api_key": explicit_api_key or "",- "base_url": explicit_base_url,- "api_mode": "",- }-- def _fake_validate(- model, provider, api_key=None, base_url=None, api_mode=None, headers=None, **kw- ):+ def _fake_validate(model, provider, api_key=None, base_url=None, **kw):+ captured["api_key"] = api_keyreturn {"accepted": True, "persist": True, "recognized": True, "message": ""}- import hermes_cli.model_switch as msimport hermes_cli.models_validate as mv-- monkeypatch.setattr(- "hermes_cli.runtime_provider.resolve_runtime_provider", _fake_runtime- )- monkeypatch.setattr(ms, "resolve_alias", lambda *a, **k: None)monkeypatch.setattr(mv, "validate_requested_model", _fake_validate)return captured@@ -102,27 +83,10 @@ def test_model_pick_resolves_key_env_from_profile_scope(client, homes, probe):assert resp.status_code == 200, resp.text# The profile's key, not the dashboard home's value from the process env.assert probe["api_key"] == "profile-key"---def test_model_pick_persists_into_profile_config(client, homes, probe):- """The save span still lands in the named profile's config.yaml."""- _, demo = homes- secret_scope.set_multiplex_active(True)- try:- resp = client.put(- "/api/profiles/demo/model", json={"provider": "acme", "model": "acme/mini"}- )- finally:- secret_scope.set_multiplex_active(False)-- assert resp.status_code == 200, resp.textfrom hermes_cli.config import load_configfrom hermes_cli.web_server_profiles import _hermes_home_scope-- with _hermes_home_scope(demo):- model_cfg = load_config().get("model") or {}- assert model_cfg.get("default") == "acme/mini"- assert model_cfg.get("provider") == "acme"+ with _hermes_home_scope(homes[1]):+ assert (load_config().get("model") or {}).get("default") == "acme/mini"def test_model_pick_for_process_home_uses_launch_scope(client, homes, probe):