test: cover InlineQueryHandler in lazy-install rebind and handler-count contracts
The lazy-install placeholder test failing mid-run also left the adapter module's ParseMode as None, cascading into test_telegram_thread_fallback failures in the same CI process — all downstream of the same root.
This commit is contained in:
@@ -672,13 +672,14 @@ class TestRegisterHandlers:
|
||||
app = MagicMock()
|
||||
a._register_handlers(app)
|
||||
|
||||
# Five core handlers (default group, no group kwarg) plus the
|
||||
# gateway_platform_event observer alone in group 99, so it observes
|
||||
# alongside rather than displacing the core handlers.
|
||||
# Six core handlers (default group, no group kwarg — incl. the
|
||||
# inline command picker) plus the gateway_platform_event observer
|
||||
# alone in group 99, so it observes alongside rather than
|
||||
# displacing the core handlers.
|
||||
calls = app.add_handler.call_args_list
|
||||
assert len(calls) == 6
|
||||
assert len(calls) == 7
|
||||
assert len([c for c in calls if c.kwargs.get("group") == 99]) == 1
|
||||
assert len([c for c in calls if not c.kwargs]) == 5
|
||||
assert len([c for c in calls if not c.kwargs]) == 6
|
||||
|
||||
def test_rebuild_re_registers_observer(self):
|
||||
"""A second call on a fresh app (e.g. a future rebuild) re-registers
|
||||
@@ -690,7 +691,7 @@ class TestRegisterHandlers:
|
||||
a._register_handlers(first_app)
|
||||
a._register_handlers(rebuilt_app) # the rebuild path
|
||||
|
||||
assert rebuilt_app.add_handler.call_count == 6
|
||||
assert rebuilt_app.add_handler.call_count == 7
|
||||
assert len(self._observer_calls(rebuilt_app)) == 1
|
||||
|
||||
def test_transient_init_rebuild_uses_shared_registration(self, monkeypatch):
|
||||
|
||||
@@ -47,6 +47,7 @@ def fake_telegram_sdk(monkeypatch):
|
||||
"Application",
|
||||
"CommandHandler",
|
||||
"CallbackQueryHandler",
|
||||
"InlineQueryHandler",
|
||||
"MessageHandler",
|
||||
"TypeHandler",
|
||||
"HTTPXRequest",
|
||||
@@ -69,6 +70,7 @@ def fake_telegram_sdk(monkeypatch):
|
||||
"Application",
|
||||
"CommandHandler",
|
||||
"CallbackQueryHandler",
|
||||
"InlineQueryHandler",
|
||||
"MessageHandler",
|
||||
"TypeHandler",
|
||||
):
|
||||
@@ -119,6 +121,7 @@ def test_lazy_install_rebinds_every_placeholder(monkeypatch, fake_telegram_sdk):
|
||||
"Application",
|
||||
"CommandHandler",
|
||||
"CallbackQueryHandler",
|
||||
"InlineQueryHandler",
|
||||
"TelegramMessageHandler",
|
||||
"TypeHandler",
|
||||
"ContextTypes",
|
||||
|
||||
Reference in New Issue
Block a user