From 7b85a9430f09cd9967a99368323853b1fd925b10 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 26 Apr 2014 21:35:07 +0300 Subject: [PATCH] tests: Additional REMOVE_CRED coverage Signed-off-by: Jouni Malinen --- tests/hwsim/test_wpas_ctrl.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/hwsim/test_wpas_ctrl.py b/tests/hwsim/test_wpas_ctrl.py index 09b0f8ec5..d3caa15c8 100644 --- a/tests/hwsim/test_wpas_ctrl.py +++ b/tests/hwsim/test_wpas_ctrl.py @@ -340,6 +340,39 @@ def test_wpas_ctrl_cred(dev): if len(dev[0].request("LIST_CREDS").splitlines()) != 1: raise Exception("Unexpected LIST_CREDS result(4)") + id = add_cred(dev[0]) + set_cred_quoted(dev[0], id, "domain", "foo.example.com") + id = add_cred(dev[0]) + set_cred_quoted(dev[0], id, "domain", "bar.example.com") + id = add_cred(dev[0]) + set_cred_quoted(dev[0], id, "domain", "foo.example.com") + if "OK" not in dev[0].request("REMOVE_CRED sp_fqdn=foo.example.com"): + raise Exception("REMOVE_CRED failed") + creds = dev[0].request("LIST_CREDS") + if "foo.example.com" in creds: + raise Exception("REMOVE_CRED sp_fqdn did not remove cred") + if "bar.example.com" not in creds: + raise Exception("REMOVE_CRED sp_fqdn removed incorrect cred") + dev[0].request("REMOVE_CRED all") + + id = add_cred(dev[0]) + set_cred_quoted(dev[0], id, "domain", "foo.example.com") + set_cred_quoted(dev[0], id, "provisioning_sp", "sp.foo.example.com") + id = add_cred(dev[0]) + set_cred_quoted(dev[0], id, "domain", "bar.example.com") + set_cred_quoted(dev[0], id, "provisioning_sp", "sp.bar.example.com") + id = add_cred(dev[0]) + set_cred_quoted(dev[0], id, "domain", "foo.example.com") + set_cred_quoted(dev[0], id, "provisioning_sp", "sp.foo.example.com") + if "OK" not in dev[0].request("REMOVE_CRED provisioning_sp=sp.foo.example.com"): + raise Exception("REMOVE_CRED failed") + creds = dev[0].request("LIST_CREDS") + if "foo.example.com" in creds: + raise Exception("REMOVE_CRED provisioning_sp did not remove cred") + if "bar.example.com" not in creds: + raise Exception("REMOVE_CRED provisioning_sp removed incorrect cred") + dev[0].request("REMOVE_CRED all") + # Test large number of creds and LIST_CREDS truncation dev[0].dump_monitor() for i in range(0, 100):