mirror of
https://github.com/HuFlungDu/pylibmeshctrl.git
synced 2026-02-20 13:42:11 +00:00
Compare commits
2 Commits
fix/bad-au
...
fix/list-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc5f2fda4b | ||
|
|
271f9fac23 |
@@ -206,17 +206,30 @@ async def test_mesh_device(env):
|
|||||||
|
|
||||||
r = await admin_session.list_devices(details=True, timeout=10)
|
r = await admin_session.list_devices(details=True, timeout=10)
|
||||||
print("\ninfo list_devices_details: {}\n".format(r))
|
print("\ninfo list_devices_details: {}\n".format(r))
|
||||||
|
assert len(r), "No devices found"
|
||||||
|
assert r[0].mesh is not None, "No mesh found"
|
||||||
|
assert r[0].mesh.name is not None, "Mesh details not filled correctly"
|
||||||
|
|
||||||
r = await admin_session.list_devices(group=mesh.name, timeout=10)
|
r = await admin_session.list_devices(group=mesh.name, timeout=10)
|
||||||
print("\ninfo list_devices_group: {}\n".format(r))
|
print("\ninfo list_devices_group: {}\n".format(r))
|
||||||
|
assert len(r), "No devices found"
|
||||||
|
assert r[0].mesh is not None, "No mesh found"
|
||||||
|
assert r[0].mesh.name is not None, "Mesh details not filled correctly"
|
||||||
|
|
||||||
r = await admin_session.list_devices(meshid=mesh.meshid, timeout=10)
|
r = await admin_session.list_devices(meshid=mesh.meshid, timeout=10)
|
||||||
print("\ninfo list_devices_meshid: {}\n".format(r))
|
print("\ninfo list_devices_meshid: {}\n".format(r))
|
||||||
|
assert len(r), "No devices found"
|
||||||
|
assert r[0].mesh is not None, "No mesh found"
|
||||||
|
assert r[0].mesh.name is not None, "Mesh details not filled correctly"
|
||||||
|
|
||||||
# Test editing device info propagating correctly
|
# Test editing device info propagating correctly
|
||||||
assert await admin_session.edit_device(agent.nodeid, name="new_name", description="New Description", tags="device", consent=meshctrl.constants.ConsentFlags.all, timeout=10), "Failed to edit device info"
|
assert await admin_session.edit_device(agent.nodeid, name="new_name", description="New Description", tags="device", consent=meshctrl.constants.ConsentFlags.all, timeout=10), "Failed to edit device info"
|
||||||
|
|
||||||
assert (await privileged_session.device_info(agent.nodeid, timeout=10)).name == "new_name", "New name did not propagate to other sessions"
|
r = await privileged_session.device_info(agent.nodeid, timeout=10)
|
||||||
|
print("\ninfo privileged_device_info: {}\n".format(r))
|
||||||
|
assert r.name == "new_name", "New name did not propagate to other sessions"
|
||||||
|
assert r.mesh is not None, "No mesh found"
|
||||||
|
assert r.mesh.name is not None, "Mesh details not filled correctly"
|
||||||
|
|
||||||
assert await admin_session.edit_device(agent.nodeid, consent=meshctrl.constants.ConsentFlags.none, timeout=10), "Failed to edit device info"
|
assert await admin_session.edit_device(agent.nodeid, consent=meshctrl.constants.ConsentFlags.none, timeout=10), "Failed to edit device info"
|
||||||
|
|
||||||
@@ -252,7 +265,8 @@ async def test_mesh_device(env):
|
|||||||
|
|
||||||
# Test getting individual device info
|
# Test getting individual device info
|
||||||
r = await unprivileged_session.device_info(agent.nodeid, timeout=10)
|
r = await unprivileged_session.device_info(agent.nodeid, timeout=10)
|
||||||
print("\ninfo device_info: {}\n".format(r))
|
print("\ninfo unprivileged_device_info: {}\n".format(r))
|
||||||
|
assert r.mesh is None or r.mesh.name is None, "Unprivileged user can see mesh"
|
||||||
|
|
||||||
# This device info includes the mesh ID of the device, even though the user doesn't have acces to that mesh. That's odd.
|
# This device info includes the mesh ID of the device, even though the user doesn't have acces to that mesh. That's odd.
|
||||||
# assert r.meshid is None, "Individual device is exposing its meshid"
|
# assert r.meshid is None, "Individual device is exposing its meshid"
|
||||||
|
|||||||
Reference in New Issue
Block a user