Allow coercible chat_id values (#186)

Co-authored-by: banteg <4562643+banteg@users.noreply.github.com>
This commit is contained in:
ayvee
2026-03-02 15:27:48 +07:00
committed by GitHub
parent 058092c1a1
commit 10775bf9eb
4 changed files with 43 additions and 6 deletions
+16
View File
@@ -130,6 +130,22 @@ def test_projects_chat_id_must_be_unique() -> None:
)
def test_projects_string_chat_id_is_coerced() -> None:
config = {
"transports": {"telegram": {"bot_token": "token", "chat_id": 123}},
"projects": {"z80": {"path": "/tmp/repo", "chat_id": "-10"}},
}
settings = TakopiSettings.model_validate(config)
projects = settings.to_projects_config(
config_path=Path("takopi.toml"),
engine_ids=["codex"],
reserved=RESERVED_CHAT_COMMANDS,
)
assert projects.projects["z80"].chat_id == -10
assert projects.chat_map[-10] == "z80"
def test_projects_relative_path_resolves(tmp_path: Path) -> None:
config_path = tmp_path / "takopi.toml"
settings = TakopiSettings.model_validate(