LichessStatTgWeb/tests/bot/test_wiring.py
vrubelroman 58bf8b7381
All checks were successful
CI/CD Pipeline / build-and-deploy (push) Successful in 29s
drop the 'player quiet for 30 days' prompt (owner decision)
The bot sends nothing on its own initiative except reports and the closed /
not-found account notices. Removes the periodic check, the sl: callbacks,
the silent_prompt_at column migration, the i18n keys and their tests.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-21 11:58:51 +00:00

34 lines
1.2 KiB
Python

"""Handler wiring of both bots against the real python-telegram-bot: the handler counts per group."""
from tests.bot import _env # noqa: F401 (environment before bot imports)
import unittest
from telegram.ext import Application
from bot import LichessBot
from admin_bot import AdminBot
DUMMY_TOKEN = "123456:ABCDEF"
def handler_groups(application: Application) -> dict:
return {group: len(handlers) for group, handlers in application.handlers.items()}
class WiringTests(unittest.TestCase):
def test_user_bot_handlers(self):
application = Application.builder().token(DUMMY_TOKEN).build()
bot = LichessBot()
bot.setup_handlers(application)
# 1 conversation + 17 commands + name text + 11 callbacks + non-text + unknown command
self.assertEqual({-1: 1, 0: 29}, handler_groups(application))
self.assertIs(application, bot.monitor.application)
def test_admin_bot_handlers(self):
application = Application.builder().token(DUMMY_TOKEN).build()
AdminBot().setup_handlers(application)
self.assertEqual({0: 7}, handler_groups(application)) # 2 conversations + start, status, counters, events, events_file
if __name__ == '__main__':
unittest.main()