test: Update python scripts with dbus interface changes

This commit is contained in:
Andrew Zaborowski 2016-05-21 03:39:37 +02:00 committed by Denis Kenzior
parent ab1319a9d5
commit ea6db49e8d
2 changed files with 22 additions and 16 deletions

View File

@ -6,31 +6,37 @@ import dbus
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object("net.connman.iwd", "/"),
"net.connman.iwd.Manager")
devices = manager.GetDevices()
"org.freedesktop.DBus.ObjectManager")
objects = manager.GetManagedObjects()
for path in objects:
if 'net.connman.iwd.Device' not in objects[path]:
continue
device = objects[path]['net.connman.iwd.Device']
for path in devices:
print("[ %s ]" % path)
properties = devices[path]
for key in properties.keys():
val = properties[key]
for key in device.keys():
val = device[key]
print(" %s = %s" % (key, val))
print(" Networks:")
device = dbus.Interface(bus.get_object("net.connman.iwd", path),
"net.connman.iwd.Device")
networks = device.GetNetworks()
for path in networks:
print(" [ %s ]" % path)
properties = networks[path]
for path2 in objects:
if not path2.startswith(path) or \
'net.connman.iwd.Network' not in objects[path2]:
continue
for key in properties.keys():
network = objects[path2]['net.connman.iwd.Network']
print(" [ %s ]" % path2)
for key in network.keys():
if key in ["SSID"]:
val = properties[key]
val = network[key]
val = "".join(map(chr, val))
else:
val = properties[key]
val = network[key]
print(" %s = %s" % (key, val))

View File

@ -55,7 +55,7 @@ if __name__ == '__main__':
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('net.connman.iwd', "/"),
'net.connman.iwd.Manager')
'net.connman.iwd.AgentManager')
path = "/test/agent/" + str(randrange(100))
object = Agent(bus, path)