Add simple test script for D-Bus supplicant
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 12 Mar 2008 13:53:14 +0000 (14:53 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 12 Mar 2008 13:53:14 +0000 (14:53 +0100)
test/Makefile.am
test/test-supplicant [new file with mode: 0755]

index f3ae183..0276029 100644 (file)
@@ -1,4 +1,5 @@
 
-EXTRA_DIST = list-interfaces start-scanning simple-agent show-introspection
+EXTRA_DIST = list-interfaces start-scanning simple-agent \
+                               show-introspection test-supplicant
 
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/test/test-supplicant b/test/test-supplicant
new file mode 100755 (executable)
index 0000000..e79228d
--- /dev/null
@@ -0,0 +1,59 @@
+#!/usr/bin/python
+
+import dbus
+import time
+
+WPA_NAME='fi.epitest.hostap.WPASupplicant'
+WPA_INTF='fi.epitest.hostap.WPASupplicant'
+WPA_PATH='/fi/epitest/hostap/WPASupplicant'
+
+bus = dbus.SystemBus()
+
+dummy = dbus.Interface(bus.get_object(WPA_NAME, WPA_PATH),
+                               'org.freedesktop.DBus.Introspectable')
+
+#print dummy.Introspect()
+
+manager = dbus.Interface(bus.get_object(WPA_NAME, WPA_PATH), WPA_INTF)
+
+try:
+       path = manager.getInterface("wlan0")
+except:
+       path = manager.addInterface("wlan0")
+
+interface = dbus.Interface(bus.get_object(WPA_NAME, path),
+                                       WPA_INTF + ".Interface")
+
+print interface.state()
+
+print interface.scan()
+
+print "[ %s ]" % (path)
+
+capabilities = interface.capabilities()
+
+for key in capabilities.keys():
+       list = ""
+       for value in capabilities[key]:
+               list += " " + value
+       print "    %s =%s" % (key, list)
+
+time.sleep(2)
+
+print interface.state()
+
+results = interface.scanResults()
+
+print results
+
+path = results[0]
+
+print "[ %s ]" % (path)
+
+bssid = dbus.Interface(bus.get_object(WPA_NAME, path),
+                                       WPA_INTF + ".BSSID")
+
+properties = bssid.properties()
+
+for key in properties.keys():
+       print "    %s = %s" % (key, properties[key])