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
30 lines
811 B
Python
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)
|
|
|