diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py index ec9b4cac3..2d8b47fb4 100644 --- a/tests/hwsim/test_ap_hs20.py +++ b/tests/hwsim/test_ap_hs20.py @@ -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