forked from Narcissus/pylibmeshctrl
Compare commits
2 Commits
1.3.2
...
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)
|
||||
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)
|
||||
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)
|
||||
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
|
||||
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"
|
||||
|
||||
@@ -252,7 +265,8 @@ async def test_mesh_device(env):
|
||||
|
||||
# Test getting individual device info
|
||||
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.
|
||||
# assert r.meshid is None, "Individual device is exposing its meshid"
|
||||
|
||||
Reference in New Issue
Block a user