Add test script for network creation
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 9 Dec 2008 17:45:52 +0000 (18:45 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 9 Dec 2008 17:45:52 +0000 (18:45 +0100)
test/Makefile.am
test/create-network [new file with mode: 0755]

index 9bf9ecf..1e38eff 100644 (file)
@@ -1,7 +1,8 @@
 
 EXTRA_DIST = get-state list-profiles list-connections \
                list-devices enable-device disable-device start-scanning \
-               list-networks select-network disable-network set-passphrase \
-               simple-agent show-introspection test-manager test-compat
+               list-networks select-network disable-network create-network \
+               set-passphrase simple-agent show-introspection \
+               test-manager test-compat
 
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/test/create-network b/test/create-network
new file mode 100755 (executable)
index 0000000..32c8ab3
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+if (len(sys.argv) < 2):
+       print "Usage: %s <network>" % (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["Type"] != "wifi" and properties["Type"] != "wimax"):
+               continue;
+
+       path = device.CreateNetwork({ "WiFi.SSID": sys.argv[1] });