From: Marcel Holtmann Date: Fri, 30 Jul 2010 05:04:49 +0000 (-0700) Subject: Add test script for retrieving proxy auto-configuration X-Git-Tag: 0.56~36 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1fd3f334bf70e38c1d0481028b51bab02e2cec59;hp=e52b36681d1a84274a05eef552b9c717c65a5e57;p=platform%2Fupstream%2Fconnman.git Add test script for retrieving proxy auto-configuration --- diff --git a/Makefile.am b/Makefile.am index 3539284..9b46644 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 index 0000000..25e0dd0 --- /dev/null +++ b/test/get-proxy-autoconfig @@ -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)