summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-12-28 02:54:09 +0100
committerMarcel Holtmann <marcel@holtmann.org>2008-12-28 02:54:09 +0100
commitdba2854c4a36e8848aeec7b1e7d8c24b17147222 (patch)
tree3c66873f18d06a3a209b511ec2c4e621ebfd931d /test
parent0e0df318a9d596ebe32f6691418e99f2eb750e40 (diff)
downloadconnman-dba2854c4a36e8848aeec7b1e7d8c24b17147222.tar.gz
connman-dba2854c4a36e8848aeec7b1e7d8c24b17147222.tar.bz2
connman-dba2854c4a36e8848aeec7b1e7d8c24b17147222.zip
Add test script for changing device policy
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am2
-rwxr-xr-xtest/set-policy28
2 files changed, 29 insertions, 1 deletions
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 <device> <policy>" % (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])