Add test script for retrieving proxy auto-configuration
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 30 Jul 2010 05:04:49 +0000 (22:04 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 30 Jul 2010 05:04:49 +0000 (22:04 -0700)
Makefile.am
test/get-proxy-autoconfig [new file with mode: 0755]

index 3539284..9b46644 100644 (file)
@@ -173,7 +173,7 @@ test_scripts = test/get-state test/list-profiles test/list-services \
                test/connect-vpn test/disconnect-vpn test/list-providers \
                test/monitor-manager test/test-counter test/set-ip-method \
                test/set-nameservers test/set-domains test/find-service \
-               test/get-services \
+               test/get-services test/get-proxy-autoconfig \
                test/enable-tethering test/disable-tethering
 
 if TEST
diff --git a/test/get-proxy-autoconfig b/test/get-proxy-autoconfig
new file mode 100755 (executable)
index 0000000..25e0dd0
--- /dev/null
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+
+import dbus
+import urllib
+
+def get_pac(url):
+       conn = urllib.urlopen(url, proxies={})
+       data = conn.read()
+       print data
+       conn.close()
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.moblin.connman', '/'),
+                                       'org.moblin.connman.Manager')
+
+services = manager.GetServices()
+
+for entry in services:
+       path = entry[0]
+       properties = entry[1]
+
+       proxy = properties["Proxy"]
+
+       if "Method" in proxy:
+               print "[ %s ]" % (path)
+
+               method = proxy["Method"]
+               print "Method = %s" % (method)
+
+               if method in ["auto-config"]:
+                       url = proxy["URL"]
+                       print "URL = %s" % (url)
+
+                       print
+                       get_pac(url)