]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: More robust error handling for wifi_display_parsing
authorJouni Malinen <quic_jouni@quicinc.com>
Thu, 29 Aug 2024 13:00:10 +0000 (16:00 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 29 Aug 2024 17:10:22 +0000 (20:10 +0300)
Check explicitly that wfd_subelems is present in the dict instead of
failing on a key error when trying to fetch it.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
tests/hwsim/test_p2p_wifi_display.py

index 29110bca7c6965141343dd991461b60af748f020..c235181a6fcf234dc78463420e8337660e040474 100644 (file)
@@ -430,6 +430,8 @@ def _test_wifi_display_parsing(dev):
     bssid = dev[0].get_group_status_field('bssid')
     dev[2].scan_for_bss(bssid, freq=2412, force_scan=True)
     bss = dev[2].get_bss(bssid)
+    if 'wfd_subelems' not in bss:
+        raise Exception("Missing WFD elements in scan results")
     if bss['wfd_subelems'] != "000006" + wfd_devinfo:
         raise Exception("Unexpected WFD elements in scan results: " + bss['wfd_subelems'])