From 2eaf55c2bead8a0f017e0ea00b6df65a6ad7aa6c Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 11 Apr 2014 23:48:36 +0300 Subject: [PATCH] tests: ctrl_iface BLACKLIST Signed-off-by: Jouni Malinen --- tests/hwsim/test_wpas_ctrl.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/hwsim/test_wpas_ctrl.py b/tests/hwsim/test_wpas_ctrl.py index def8d021b..1b0364294 100644 --- a/tests/hwsim/test_wpas_ctrl.py +++ b/tests/hwsim/test_wpas_ctrl.py @@ -608,3 +608,34 @@ def test_wpas_ctrl_nfc_report_handover(dev): for v in vals: if "FAIL" not in dev[0].request("NFC_REPORT_HANDOVER " + v): raise Exception("Unexpected NFC_REPORT_HANDOVER success for " + v) + +def get_blacklist(dev): + return dev.request("BLACKLIST").splitlines() + +def test_wpas_ctrl_blacklist(dev): + """wpa_supplicant ctrl_iface BLACKLIST""" + if "OK" not in dev[0].request("BLACKLIST clear"): + raise Exception("BLACKLIST clear failed") + b = get_blacklist(dev[0]) + if len(b) != 0: + raise Exception("Unexpected blacklist contents: " + str(b)) + if "OK" not in dev[0].request("BLACKLIST 00:11:22:33:44:55"): + raise Exception("BLACKLIST add failed") + b = get_blacklist(dev[0]) + if "00:11:22:33:44:55" not in b: + raise Exception("Unexpected blacklist contents: " + str(b)) + if "OK" not in dev[0].request("BLACKLIST 00:11:22:33:44:56"): + raise Exception("BLACKLIST add failed") + b = get_blacklist(dev[0]) + if "00:11:22:33:44:55" not in b or "00:11:22:33:44:56" not in b: + raise Exception("Unexpected blacklist contents: " + str(b)) + if "OK" not in dev[0].request("BLACKLIST 00:11:22:33:44:56"): + raise Exception("BLACKLIST add failed") + b = get_blacklist(dev[0]) + if "00:11:22:33:44:55" not in b or "00:11:22:33:44:56" not in b or len(b) != 2: + raise Exception("Unexpected blacklist contents: " + str(b)) + + if "OK" not in dev[0].request("BLACKLIST clear"): + raise Exception("BLACKLIST clear failed") + if dev[0].request("BLACKLIST") != "": + raise Exception("Unexpected blacklist contents")