feat(tg): своя сессия Telethon — omni/tgsess.py + omni pump (глубина 200 постов вместо 20, 20 каналов -> 2832 поста, 2592 новых), CVE-ID в заголовке (471), tg_alive_audit из 856 сессий нашёл 121 живую; тесты 22
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user