refactor: simplify runtime, config, and telegram (#85)

This commit is contained in:
banteg
2026-01-11 14:48:39 +04:00
committed by GitHub
parent 2380b3e5e9
commit 194cc02bba
42 changed files with 3204 additions and 3717 deletions
+7 -2
View File
@@ -49,9 +49,13 @@ def test_check_setup_marks_missing_config(monkeypatch, tmp_path: Path) -> None:
assert result.config_path == onboarding.HOME_CONFIG_PATH
def test_check_setup_marks_invalid_chat_id(monkeypatch, tmp_path: Path) -> None:
def test_check_setup_marks_invalid_bot_token(monkeypatch, tmp_path: Path) -> None:
backend = engines.get_backend("codex")
monkeypatch.setattr(onboarding.shutil, "which", lambda _name: "/usr/bin/codex")
def _fail_require(*_args, **_kwargs):
raise onboarding.ConfigError("Missing bot token")
monkeypatch.setattr(
onboarding,
"load_settings",
@@ -59,12 +63,13 @@ def test_check_setup_marks_invalid_chat_id(monkeypatch, tmp_path: Path) -> None:
TakopiSettings.model_validate(
{
"transport": "telegram",
"transports": {"telegram": {"bot_token": "token", "chat_id": None}},
"transports": {"telegram": {"bot_token": "token", "chat_id": 123}},
}
),
tmp_path / "takopi.toml",
),
)
monkeypatch.setattr(onboarding, "require_telegram", _fail_require)
result = onboarding.check_setup(backend)