Added test for run_console_command

This commit is contained in:
Josiah Baldwin
2025-09-26 14:12:56 -07:00
parent 078e07cb4f
commit 6daaa91758

View File

@@ -259,6 +259,19 @@ async def test_mesh_device(env):
else: else:
raise Exception("Run command on a device that doesn't exist did not raise an exception") 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 # Test run commands with individual device permissions
try: try:
await unprivileged_session.run_command(agent.nodeid, "ls", timeout=10) await unprivileged_session.run_command(agent.nodeid, "ls", timeout=10)