Files
hermes-agent/tests/honcho_integration/test_cli.py
Erosika 2d35016b94 fix(honcho): harden tool gating and migration peer routing
Prevent stale Honcho tool exposure in context/local modes, restore reliable async write retry behavior, and ensure SOUL.md migration uploads target the AI peer instead of the user peer. Also align Honcho CLI key checks with host-scoped apiKey resolution and lock the fixes with regression tests.

Made-with: Cursor
2026-03-11 18:21:27 -04:00

30 lines
811 B
Python

"""Tests for Honcho CLI helpers."""
from honcho_integration.cli import _resolve_api_key
class TestResolveApiKey:
def test_prefers_host_scoped_key(self):
cfg = {
"apiKey": "root-key",
"hosts": {
"hermes": {
"apiKey": "host-key",
}
},
}
assert _resolve_api_key(cfg) == "host-key"
def test_falls_back_to_root_key(self):
cfg = {
"apiKey": "root-key",
"hosts": {"hermes": {}},
}
assert _resolve_api_key(cfg) == "root-key"
def test_falls_back_to_env_key(self, monkeypatch):
monkeypatch.setenv("HONCHO_API_KEY", "env-key")
assert _resolve_api_key({}) == "env-key"
monkeypatch.delenv("HONCHO_API_KEY", raising=False)