]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Open Hotspot 2.0 icon files in binary modes for python3
authorMasashi Honma <masashi.honma@gmail.com>
Sun, 3 Feb 2019 23:15:36 +0000 (01:15 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 4 Feb 2019 10:26:34 +0000 (12:26 +0200)
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
tests/hwsim/test_ap_hs20.py

index c9bc63c77ed4771878e0f723cfc6e6099bf1d0c5..1d7b40b805383a94c51608124f8a0cdbdf4740d6 100644 (file)
@@ -2923,7 +2923,7 @@ def test_ap_hs20_fetch_osu(dev, apdev):
     params['osu_server_uri'] = "https://example.org/osu/"
     hostapd.add_ap(apdev[1], params)
 
-    with open("w1fi_logo.png", "r") as f:
+    with open("w1fi_logo.png", "rb") as f:
         orig_logo = f.read()
     dev[0].hs20_enable()
     dir = "/tmp/osu-fetch"
@@ -2956,7 +2956,7 @@ def test_ap_hs20_fetch_osu(dev, apdev):
             if "OSU provider fetch completed" in ev:
                 break
             if "RX-HS20-ANQP-ICON" in ev:
-                with open(ev.split(' ')[1], "r") as f:
+                with open(ev.split(' ')[1], "rb") as f:
                     logo = f.read()
                     if logo == orig_logo:
                         icons += 1
@@ -3024,7 +3024,7 @@ def test_ap_hs20_fetch_osu(dev, apdev):
     hex = binascii.hexlify(icon).decode()
     if not hex.startswith("0009696d6167652f706e677d1d"):
         raise Exception("Unexpected beacon binary header: " + hex)
-    with open('w1fi_logo.png', 'r') as f:
+    with open('w1fi_logo.png', 'rb') as f:
         data = f.read()
         if icon[13:] != data:
             raise Exception("Unexpected icon data")
@@ -3304,12 +3304,12 @@ def run_req_hs20_icon(dev, bssid):
     hdr, data1 = get_icon(dev[0], bssid, "w1fi_logo")
     hdr, data2 = get_icon(dev[0], bssid, "test_logo")
 
-    with open('w1fi_logo.png', 'r') as f:
+    with open('w1fi_logo.png', 'rb') as f:
         data = f.read()
         if data1 != data:
             raise Exception("Unexpected icon data (1)")
 
-    with open('auth_serv/sha512-server.pem', 'r') as f:
+    with open('auth_serv/sha512-server.pem', 'rb') as f:
         data = f.read()
         if data2 != data:
             raise Exception("Unexpected icon data (2)")
@@ -3458,12 +3458,12 @@ def test_ap_hs20_req_hs20_icon_parallel(dev, apdev):
     hdr, data1 = get_icon(dev[0], bssid, "w1fi_logo")
     hdr, data2 = get_icon(dev[0], bssid, "test_logo")
 
-    with open('w1fi_logo.png', 'r') as f:
+    with open('w1fi_logo.png', 'rb') as f:
         data = f.read()
         if data1 != data:
             raise Exception("Unexpected icon data (1)")
 
-    with open('auth_serv/sha512-server.pem', 'r') as f:
+    with open('auth_serv/sha512-server.pem', 'rb') as f:
         data = f.read()
         if data2 != data:
             raise Exception("Unexpected icon data (2)")