aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2016-03-06 18:54:16 (GMT)
committerJouni Malinen <j@w1.fi>2016-03-06 18:54:16 (GMT)
commitdbd183c717a0f2594a4ace11b4b69a915f060d49 (patch)
tree24706dc4522095f0655a051a51e2b73d32278641
parentc7fb678f3109e62af1ef39be9b12bf8370c35bde (diff)
downloadhostap-dbd183c717a0f2594a4ace11b4b69a915f060d49.zip
hostap-dbd183c717a0f2594a4ace11b4b69a915f060d49.tar.gz
hostap-dbd183c717a0f2594a4ace11b4b69a915f060d49.tar.bz2
tests: D-Bus AssocStatusCode
Signed-off-by: Jouni Malinen <j@w1.fi>
-rw-r--r--tests/hwsim/test_dbus.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py
index 61b7ddd..b07c841 100644
--- a/tests/hwsim/test_dbus.py
+++ b/tests/hwsim/test_dbus.py
@@ -5163,3 +5163,54 @@ def _test_dbus_vendor_elem(dev, apdev):
except dbus.exceptions.DBusException, e:
if "InvalidArgs" not in str(e) or "ID value does not exist" not in str(e):
raise Exception("Unexpected error message for invalid VendorElemGet after removal: " + str(e))
+
+def test_dbus_assoc_reject(dev, apdev):
+ """D-Bus AssocStatusCode"""
+ (bus,wpas_obj,path,if_obj) = prepare_dbus(dev[0])
+ iface = dbus.Interface(if_obj, WPAS_DBUS_IFACE)
+
+ ssid = "test-open"
+ params = { "ssid": ssid,
+ "max_listen_interval": "1" }
+ hapd = hostapd.add_ap(apdev[0]['ifname'], params)
+
+ class TestDbusConnect(TestDbus):
+ def __init__(self, bus):
+ TestDbus.__init__(self, bus)
+ self.assoc_status_seen = False
+ self.state = 0
+
+ def __enter__(self):
+ gobject.timeout_add(1, self.run_connect)
+ gobject.timeout_add(15000, self.timeout)
+ self.add_signal(self.propertiesChanged, WPAS_DBUS_IFACE,
+ "PropertiesChanged")
+ self.loop.run()
+ return self
+
+ def propertiesChanged(self, properties):
+ logger.debug("propertiesChanged: %s" % str(properties))
+ if 'AssocStatusCode' in properties:
+ status = properties['AssocStatusCode']
+ if status != 51:
+ logger.info("Unexpected status code: " + str(status))
+ else:
+ self.assoc_status_seen = True
+ iface.Disconnect()
+ self.loop.quit()
+
+ def run_connect(self, *args):
+ args = dbus.Dictionary({ 'ssid': ssid,
+ 'key_mgmt': 'NONE',
+ 'scan_freq': 2412 },
+ signature='sv')
+ self.netw = iface.AddNetwork(args)
+ iface.SelectNetwork(self.netw)
+ return False
+
+ def success(self):
+ return self.assoc_status_seen
+
+ with TestDbusConnect(bus) as t:
+ if not t.success():
+ raise Exception("Expected signals not seen")