From edc4374ef592e4e394be446439ee109d0ace1200 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 30 Apr 2018 20:19:01 +0300 Subject: [PATCH] tests: pending_tc table check for HS 2.0 Terms and Conditions Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_hs20.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py index af70d59d0..ff0725e70 100644 --- a/tests/hwsim/test_ap_hs20.py +++ b/tests/hwsim/test_ap_hs20.py @@ -5839,6 +5839,7 @@ def test_ap_hs20_terms_and_conditions_sql(dev, apdev, params): cur.execute("INSERT INTO users(identity,methods,password,phase2) VALUES ('user-mschapv2','TTLS-MSCHAPV2','password',1)") cur.execute("INSERT INTO wildcards(identity,methods) VALUES ('','TTLS,TLS')") cur.execute("CREATE TABLE authlog(timestamp TEXT, session TEXT, nas_ip TEXT, username TEXT, note TEXT)") + cur.execute("CREATE TABLE pending_tc(mac_addr TEXT PRIMARY KEY, identity TEXT)") try: params = { "ssid": "as", "beacon_int": "2000", @@ -5890,6 +5891,14 @@ def test_ap_hs20_terms_and_conditions_sql(dev, apdev, params): # Simulate T&C server operation on user reading the updated version with con: cur = con.cursor() + cur.execute("SELECT identity FROM pending_tc WHERE mac_addr='" + + dev[0].own_addr() + "'") + rows = cur.fetchall() + if len(rows) != 1: + raise Exception("No pending_tc entry found") + if rows[0][0] != 'user-mschapv2': + raise Exception("Unexpected pending_tc identity value") + cur.execute("UPDATE users SET t_c_timestamp=123456789 WHERE identity='user-mschapv2'") dev[0].request("RECONNECT")