From 1fd3f334bf70e38c1d0481028b51bab02e2cec59 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 29 Jul 2010 22:04:49 -0700 Subject: [PATCH 1/1] Add test script for retrieving proxy auto-configuration --- Makefile.am | 2 +- test/get-proxy-autoconfig | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100755 test/get-proxy-autoconfig 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) -- 2.7.4