fix(config): harden onboarding and command menu (#70)

This commit is contained in:
banteg
2026-01-08 18:16:55 +04:00
committed by GitHub
parent dfd6e65b77
commit 4227bee1ef
9 changed files with 206 additions and 27 deletions
+36
View File
@@ -136,6 +136,42 @@ def test_engine_config_none_and_invalid(tmp_path: Path) -> None:
settings.engine_config("codex", config_path=config_path)
def test_transport_config_telegram_and_extra(tmp_path: Path) -> None:
config_path = tmp_path / "takopi.toml"
settings = TakopiSettings.model_validate(
{
"transport": "telegram",
"transports": {"telegram": {"bot_token": "token", "chat_id": 123}},
}
)
telegram = settings.transport_config("telegram", config_path=config_path)
assert telegram["bot_token"] == "token"
assert telegram["chat_id"] == 123
settings = TakopiSettings.model_validate(
{
"transport": "telegram",
"transports": {
"telegram": {"bot_token": "token", "chat_id": 123},
"discord": None,
},
}
)
assert settings.transport_config("discord", config_path=config_path) == {}
settings = TakopiSettings.model_validate(
{
"transport": "telegram",
"transports": {
"telegram": {"bot_token": "token", "chat_id": 123},
"discord": "nope",
},
}
)
with pytest.raises(ConfigError, match="transports.discord"):
settings.transport_config("discord", config_path=config_path)
def test_bot_token_none_allowed() -> None:
settings = TakopiSettings.model_validate(
{