From dba2854c4a36e8848aeec7b1e7d8c24b17147222 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 28 Dec 2008 02:54:09 +0100 Subject: Add test script for changing device policy --- test/Makefile.am | 2 +- test/set-policy | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100755 test/set-policy (limited to 'test') diff --git a/test/Makefile.am b/test/Makefile.am index 30546b9c..f39d13e2 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 00000000..5f26690a --- /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]) -- cgit v1.2.3