feat(tg): своя сессия Telethon — omni/tgsess.py + omni pump (глубина 200 постов вместо 20, 20 каналов -> 2832 поста, 2592 новых), CVE-ID в заголовке (471), tg_alive_audit из 856 сессий нашёл 121 живую; тесты 22
Some checks failed
ci / test (3.10) (push) Has been cancelled
ci / test (3.11) (push) Has been cancelled
ci / test (3.12) (push) Has been cancelled

This commit is contained in:
Vlad Gothbreach
2026-10-26 22:43:21 +03:00
parent 74d968ab2d
commit aa417d635b
7 changed files with 266 additions and 17 deletions

View File

@@ -182,3 +182,23 @@ def test_tag_command_readonly(monkeypatch):
bot.handle({"message": {"chat": {"id": 1}, "from": {"id": 1}, "text": "/tag"}})
assert sent and "типы записей" in sent[0], sent[:1]
assert "/tag" in bot.CMDS
# ---------- 12. сессия Telegram: выключена без env, CVE в заголовке ----------
def test_tgsess_disabled_without_env(monkeypatch):
from omni import tgsess
for k in ("OMNI_TG_SESSION", "OMNI_TG_API_ID", "OMNI_TG_API_HASH"):
monkeypatch.delenv(k, raising=False)
assert tgsess.enabled() is False
assert tgsess.fetch(["thehackernews"], 5) == []
assert tgsess._key("@SomeChan/") == "SomeChan"
def test_item_cve_prefix():
from types import SimpleNamespace
from omni.feeds import _item
src = SimpleNamespace(name="tg_cvefeed", tags=["cve"])
it = _item(src, "post", "https://t.me/cvefeed/1", "Improper neutralization of input",
"Details: CVE-2026-12345 affects the parser badly.")
assert it.title.startswith("CVE-2026-12345"), it.title