tests: Don't use proxy in urllib.urlopen()
Some environments define default system wide HTTP proxy. Using default system configuration may result in a failure to open some HTTP URLs. Fix this by ensuring that no proxies are used. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
This commit is contained in:
parent
fc30cc10ac
commit
aa713e71e9
1 changed files with 4 additions and 3 deletions
|
@ -2696,7 +2696,7 @@ def ssdp_get_location(uuid):
|
||||||
return location
|
return location
|
||||||
|
|
||||||
def upnp_get_urls(location):
|
def upnp_get_urls(location):
|
||||||
conn = urllib.urlopen(location)
|
conn = urllib.urlopen(location, proxies={})
|
||||||
tree = ET.parse(conn)
|
tree = ET.parse(conn)
|
||||||
root = tree.getroot()
|
root = tree.getroot()
|
||||||
urn = '{urn:schemas-upnp-org:device-1-0}'
|
urn = '{urn:schemas-upnp-org:device-1-0}'
|
||||||
|
@ -2748,10 +2748,11 @@ def test_ap_wps_upnp(dev, apdev):
|
||||||
location = ssdp_get_location(ap_uuid)
|
location = ssdp_get_location(ap_uuid)
|
||||||
urls = upnp_get_urls(location)
|
urls = upnp_get_urls(location)
|
||||||
|
|
||||||
conn = urllib.urlopen(urls['scpd_url'])
|
conn = urllib.urlopen(urls['scpd_url'], proxies={})
|
||||||
scpd = conn.read()
|
scpd = conn.read()
|
||||||
|
|
||||||
conn = urllib.urlopen(urlparse.urljoin(location, "unknown.html"))
|
conn = urllib.urlopen(urlparse.urljoin(location, "unknown.html"),
|
||||||
|
proxies={})
|
||||||
if conn.getcode() != 404:
|
if conn.getcode() != 404:
|
||||||
raise Exception("Unexpected HTTP response to GET unknown URL")
|
raise Exception("Unexpected HTTP response to GET unknown URL")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue