From: Marcel Holtmann Date: Sun, 28 Dec 2008 01:54:09 +0000 (+0100) Subject: Add test script for changing device policy X-Git-Tag: 2.0_alpha~4305 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dba2854c4a36e8848aeec7b1e7d8c24b17147222;p=framework%2Fconnectivity%2Fconnman.git Add test script for changing device policy --- diff --git a/test/Makefile.am b/test/Makefile.am index 30546b9..f39d13e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -3,6 +3,6 @@ EXTRA_DIST = get-state list-profiles list-connections select-connection \ list-devices enable-device disable-device start-scanning \ list-networks select-network disable-network create-network \ set-passphrase set-address simple-agent show-introspection \ - test-manager test-compat monitor-connman + set-policy test-manager test-compat monitor-connman MAINTAINERCLEANFILES = Makefile.in diff --git a/test/set-policy b/test/set-policy new file mode 100755 index 0000000..5f26690 --- /dev/null +++ b/test/set-policy @@ -0,0 +1,28 @@ +#!/usr/bin/python + +import sys +import dbus + +if (len(sys.argv) < 3): + print "Usage: %s " % (sys.argv[0]) + sys.exit(1) + +bus = dbus.SystemBus() + +manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"), + "org.moblin.connman.Manager") + +properties = manager.GetProperties() + +for path in properties["Devices"]: + device = dbus.Interface(bus.get_object("org.moblin.connman", path), + "org.moblin.connman.Device") + + properties = device.GetProperties() + + if properties["Interface"] != sys.argv[1]: + continue; + + print "Setting policy \"%s\" for %s" % (sys.argv[2], path) + + device.SetProperty("Policy", sys.argv[2])