fix: make telegram config optional for external transports (#177)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: banteg <4562643+banteg@users.noreply.github.com>
This commit is contained in:
ayvee
2026-03-02 15:09:29 +07:00
committed by GitHub
parent 6cf469c8ac
commit 058092c1a1
11 changed files with 207 additions and 31 deletions
+13
View File
@@ -56,6 +56,19 @@ def test_doctor_errors_exit_nonzero(monkeypatch) -> None:
assert "telegram token: error" in result.output
def test_doctor_missing_telegram_config_exits(monkeypatch) -> None:
settings = TakopiSettings.model_validate(
{"transport": "telegram", "transports": {}}
)
monkeypatch.setattr(cli, "load_settings", lambda: (settings, Path("x")))
runner = CliRunner()
result = runner.invoke(cli.create_app(), ["doctor"])
assert result.exit_code == 1
assert "Missing [transports.telegram]" in result.output
class _FakeBot:
def __init__(self, me: User | None, chat: Chat | None) -> None:
self._me = me