tests: Hotspot 2.0 OSU provider and no AP with info
authorJouni Malinen <j@w1.fi>
Sun, 3 Jul 2016 19:08:31 +0000 (22:08 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 3 Jul 2016 19:37:01 +0000 (22:37 +0300)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_hs20.py

index ec9b4ca..2d8b47f 100644 (file)
@@ -2607,6 +2607,36 @@ def test_ap_hs20_fetch_osu(dev, apdev):
         if "FAIL" not in dev[i].request("DEL_HS20_ICON "):
             raise Exception("DEL_HS20_ICON accepted when no icons left")
 
+def test_ap_hs20_fetch_osu_no_info(dev, apdev):
+    """Hotspot 2.0 OSU provider and no AP with info"""
+    bssid = apdev[0]['bssid']
+    params = hs20_ap_params()
+    hostapd.add_ap(apdev[0], params)
+
+    dev[0].hs20_enable()
+    dir = "/tmp/osu-fetch"
+    if os.path.isdir(dir):
+       files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+       for f in files:
+           os.remove(dir + "/" + f)
+    else:
+        try:
+            os.makedirs(dir)
+        except:
+            pass
+    dev[0].scan_for_bss(bssid, freq="2412")
+    try:
+        dev[0].request("SET osu_dir " + dir)
+        dev[0].request("FETCH_OSU")
+        ev = dev[0].wait_event(["OSU provider fetch completed"], timeout=30)
+        if ev is None:
+            raise Exception("Timeout on OSU fetch")
+    finally:
+        files = [ f for f in os.listdir(dir) if f.startswith("osu-") ]
+        for f in files:
+            os.remove(dir + "/" + f)
+        os.rmdir(dir)
+
 def get_icon(dev, bssid, iconname):
     icon = ""
     pos = 0