From 1490eff500ac0d86804bd02d04a1beefa8d6d187 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 7 Dec 2014 17:36:22 +0200 Subject: [PATCH] tests: More coverage for WPS NFC error and uncommon cases Signed-off-by: Jouni Malinen --- tests/hwsim/test_nfc_wps.py | 6 ++++++ tests/hwsim/test_wpas_ctrl.py | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/tests/hwsim/test_nfc_wps.py b/tests/hwsim/test_nfc_wps.py index 454a7ec53..f93aeefe4 100644 --- a/tests/hwsim/test_nfc_wps.py +++ b/tests/hwsim/test_nfc_wps.py @@ -40,6 +40,9 @@ def test_nfc_wps_password_token_sta(dev, apdev): hostapd.add_ap(apdev[0]['ifname'], params) hapd = hostapd.Hostapd(apdev[0]['ifname']) logger.info("WPS provisioning step using password token from station") + wps = dev[0].request("WPS_NFC_TOKEN WPS").rstrip() + if "FAIL" in wps: + raise Exception("Failed to generate password token (WPS only)") pw = dev[0].request("WPS_NFC_TOKEN NDEF").rstrip() if "FAIL" in pw: raise Exception("Failed to generate password token") @@ -437,6 +440,9 @@ def test_nfc_wps_er_config_token(dev, apdev): start_ap_er(dev[0], apdev[0], ssid) hapd = hostapd.Hostapd(apdev[0]['ifname']) logger.info("WPS provisioning step using configuration token from ER") + wps = dev[0].request("WPS_ER_NFC_CONFIG_TOKEN WPS " + apdev[0]['bssid']).rstrip() + if "FAIL" in wps: + raise Exception("Failed to generate configuration token (WPS format)") conf = dev[0].request("WPS_ER_NFC_CONFIG_TOKEN NDEF " + apdev[0]['bssid']).rstrip() if "FAIL" in conf: raise Exception("Failed to generate configuration token") diff --git a/tests/hwsim/test_wpas_ctrl.py b/tests/hwsim/test_wpas_ctrl.py index decd01c00..b77c4575f 100644 --- a/tests/hwsim/test_wpas_ctrl.py +++ b/tests/hwsim/test_wpas_ctrl.py @@ -540,6 +540,13 @@ def test_wpas_ctrl_wps_errors(dev): if "FAIL" not in dev[0].request("WPS_ER_NFC_CONFIG_TOKEN NDEF 00:11:22:33:44:55"): raise Exception("Unexpected success on invalid WPS_ER_NFC_CONFIG_TOKEN") + if "FAIL" not in dev[0].request("WPS_NFC_CONFIG_TOKEN FOO"): + raise Exception("Unexpected success on invalid WPS_NFC_CONFIG_TOKEN") + if "FAIL" not in dev[0].request("WPS_NFC_CONFIG_TOKEN WPS FOO"): + raise Exception("Unexpected success on invalid WPS_NFC_CONFIG_TOKEN") + if "FAIL" not in dev[0].request("WPS_NFC_TOKEN FOO"): + raise Exception("Unexpected success on invalid WPS_NFC_TOKEN") + def test_wpas_ctrl_config_parser(dev): """wpa_supplicant ctrl_iface SET config parser""" if "FAIL" not in dev[0].request("SET pbc_in_m1 qwerty"):