From 6daaa91758a16d725721d120afa29c40036323a8 Mon Sep 17 00:00:00 2001 From: Josiah Baldwin Date: Fri, 26 Sep 2025 14:12:56 -0700 Subject: [PATCH] Added test for run_console_command --- tests/test_session.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_session.py b/tests/test_session.py index 79fa2fd..dd1c973 100644 --- a/tests/test_session.py +++ b/tests/test_session.py @@ -259,6 +259,19 @@ async def test_mesh_device(env): else: raise Exception("Run command on a device that doesn't exist did not raise an exception") + r = await admin_session.run_console_command([agent.nodeid, agent2.nodeid], "info", timeout=10) + print("\ninfo run_console_command: {}\n".format(r)) + assert agent.nodeid in r[agent.nodeid]["result"], "Run console command gave bad response" + assert agent2.nodeid in r[agent2.nodeid]["result"], "Run console command gave bad response" + + # Test run_commands missing device + try: + await admin_session.run_console_command([agent.nodeid, "notanid"], "info", timeout=10) + except* (meshctrl.exceptions.ServerError, ValueError): + pass + else: + raise Exception("Run console command on a device that doesn't exist did not raise an exception") + # Test run commands with individual device permissions try: await unprivileged_session.run_command(agent.nodeid, "ls", timeout=10)