fix(cli): canonicalize default gateway identity

This commit is contained in:
Xubin Ren
2026-08-17 20:56:10 +08:00
parent b8333a2d7e
commit a700697583
4 changed files with 70 additions and 10 deletions
+12 -1
View File
@@ -6,7 +6,7 @@ import typer
from rich.console import Console
from typer.testing import CliRunner
from nanobot.cli.gateway import create_gateway_app
from nanobot.cli.gateway import _resolved_config_selector, create_gateway_app
from nanobot.config.schema import Config
from nanobot.gateway import GatewayRuntimePaths, GatewayStartOptions, GatewayStatus, RuntimeResult
from nanobot.gateway.service import GatewayServiceOptions, GatewayServiceResult
@@ -14,6 +14,17 @@ from nanobot.gateway.service import GatewayServiceOptions, GatewayServiceResult
runner = CliRunner()
def test_default_config_has_the_same_gateway_identity_when_explicit(
monkeypatch,
tmp_path: Path,
) -> None:
config_path = tmp_path / "config.json"
monkeypatch.setattr("nanobot.config.loader._current_config_path", config_path)
assert _resolved_config_selector(None) == config_path
assert _resolved_config_selector(str(config_path)) == config_path
class FakeRuntime:
def __init__(self, tmp_path: Path):
self.paths = GatewayRuntimePaths.for_instance(data_dir=tmp_path)