Skip to content

The agent that grows with you

test: assert /update dispatch via the handler table, not getsource

kshitijk4poor740994a903af
diff --git a/tests/gateway/test_update_command.py b/tests/gateway/test_update_command.py
index 22cc9cd419b..69916e92296 100644
--- a/tests/gateway/test_update_command.py
+++ b/tests/gateway/test_update_command.py
@@ -503,13 +503,18 @@ class TestUpdateInHelp:
def test_update_is_known_command(self):
- """The /update command is in the help text (proxy for _known_commands)."""
- # _known_commands is local to _handle_message, so we verify by
- # checking the help output includes it.
+ """/update dispatches through the gateway's plain-command handler table.
+
+ (Was an inspect.getsource() check for the literal '"update"' in
+ _handle_message — a banned source-reading test. The if-chain was
+ replaced by _gateway_plain_command_handlers(), so assert the real
+ dispatch contract: the table maps "update" to the update handler.)
+ """
from gateway.run import GatewayRunner
- import inspect
- source = inspect.getsource(GatewayRunner._handle_message)
- assert '"update"' in source
+
+ runner = object.__new__(GatewayRunner)
+ handlers = runner._gateway_plain_command_handlers()
+ assert handlers.get("update") == runner._handle_update_command
class TestWatchUpdateProgress:
@pytest.mark.asyncio