Add Linkki broadcast image
Build custom container images / build (map[base_image:php:8-fpm-alpine build_args:PHP_VERSION=8 context:php8-pgsql fingerprint_command:{ apk info -v | LC_ALL=C sort; find /usr/local/lib/php/extensions /usr/local/etc/php/conf.d -type f -exec sha256sum {} + | LC_ALL=C sort; } name:ph… (push) Successful in 48s
Build custom container images / build (map[base_image:postgres:18 build_args:PG_VERSION=18 POSTGIS_VERSION=3 VCHORD_VERSION=0.5.3 context:postgres fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; find /usr/lib/postgresql -type f -exec sha256su… (push) Successful in 55s
Build custom container images / build (map[base_image:python:3 build_args:PYTHON_VERSION=3 context:python-tools fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; pip freeze | LC_ALL=C sort; } name:python-tools oci_labels:org.opencontainers.ima… (push) Successful in 54s
Build custom container images / build (map[base_image:python:3.12-slim build_args:PYTHON_VERSION=3.12-slim context:linkki-tiedotus fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; pip freeze | LC_ALL=C sort; } name:linkki-tiedotus oci_labels:… (push) Successful in 39s

This commit is contained in:
ajp_anton
2026-08-19 20:51:26 +00:00
parent 7e6dea8b24
commit 8ec3cde4f2
56 changed files with 13441 additions and 0 deletions
@@ -0,0 +1,97 @@
import json
from pathlib import Path
from webapp.telegram_targets import (
default_target_selection,
load_telegram_target_catalog,
resolve_target_config,
)
def test_multi_bot_catalog_picks_first_marked_defaults(tmp_path: Path) -> None:
config_dir = tmp_path / "config"
config_dir.mkdir()
(config_dir / "telegram_config.json").write_text(
json.dumps(
{
"bots": [
{
"display_name": "Bot A",
"token": "token-a",
"default": True,
"channels": [
{"display_name": "Channel A1", "channel_id": "-1001", "default": True},
{"display_name": "Channel A2", "channel_id": "-1002", "default": True},
],
},
{
"display_name": "Bot B",
"token": "token-b",
"default": True,
"channels": [
{"display_name": "Channel B1", "channel_id": "-2001", "default": True},
],
},
]
}
),
encoding="utf-8",
)
catalog = load_telegram_target_catalog(config_dir)
assert default_target_selection(catalog) == ("token-a", "-1001")
def test_resolve_target_config_uses_selected_bot_id_and_chat_id(tmp_path: Path) -> None:
config_dir = tmp_path / "config"
config_dir.mkdir()
(config_dir / "telegram_config.json").write_text(
json.dumps(
{
"bots": [
{
"display_name": "Bot A",
"token": "token-a",
"channels": [
{
"display_name": "Channel A1",
"channel_id": "-1001",
"channel_username": "public_a",
"discussion_group_id": "-2001",
},
],
}
]
}
),
encoding="utf-8",
)
catalog = load_telegram_target_catalog(config_dir)
config = resolve_target_config(catalog, "token-a", "-1001")
assert config.bot_token == "token-a"
assert config.chat_id == "-1001"
assert config.channel_username == "public_a"
assert config.discussion_group_id == "-2001"
def test_telegram_config_requires_top_level_bots_list(tmp_path: Path) -> None:
config_dir = tmp_path / "config"
config_dir.mkdir()
(config_dir / "telegram_config.json").write_text(
json.dumps(
{
"bot_token": "legacy-token",
}
),
encoding="utf-8",
)
try:
load_telegram_target_catalog(config_dir)
except Exception as error:
assert "top-level 'bots' list" in str(error)
else:
raise AssertionError("Expected invalid config format to be rejected.")