From 795b6f57a8c4a708fbc49c33e119db64a7ae8b5b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 9 Jan 2015 01:41:57 +0200 Subject: [PATCH] tests: Additional D-Bus error path coverage Signed-off-by: Jouni Malinen --- tests/hwsim/test_dbus.py | 18 ++++++++++++++++++ tests/hwsim/test_dbus_old.py | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py index b7f50bd41..6430722ed 100644 --- a/tests/hwsim/test_dbus.py +++ b/tests/hwsim/test_dbus.py @@ -1353,6 +1353,13 @@ def test_dbus_tdls_invalid(dev, apdev): if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid TDLSTeardown: " + str(e)) + try: + iface.TDLSTeardown("00:11:22:33:44:55") + raise Exception("TDLSTeardown accepted for unknown peer") + except dbus.exceptions.DBusException, e: + if "UnknownError: error performing TDLS teardown" not in str(e): + raise Exception("Unexpected error message: " + str(e)) + def test_dbus_tdls(dev, apdev): """D-Bus TDLS""" (bus,wpas_obj,path,if_obj) = prepare_dbus(dev[0]) @@ -2460,6 +2467,17 @@ def test_dbus_p2p_autogo(dev, apdev): if len(addr) > 0: addr += ':' addr += '%02x' % ord(p) + + params = { 'Role': 'registrar', + 'P2PDeviceAddress': self.peer['DeviceAddress'], + 'Bssid': self.peer['DeviceAddress'], + 'Type': 'pin' } + try: + wps.Start(params) + raise Exception("Invalid WPS.Start() accepted") + except dbus.exceptions.DBusException, e: + if "InvalidArgs" not in str(e): + raise Exception("Unexpected error message: " + str(e)) params = { 'Role': 'registrar', 'P2PDeviceAddress': self.peer['DeviceAddress'], 'Bssid': self.peer['DeviceAddress'], diff --git a/tests/hwsim/test_dbus_old.py b/tests/hwsim/test_dbus_old.py index 8285547c4..bc7cda0d1 100644 --- a/tests/hwsim/test_dbus_old.py +++ b/tests/hwsim/test_dbus_old.py @@ -552,6 +552,22 @@ def test_dbus_old_connect_eap(dev, apdev): if not t.success(): raise Exception("Expected signals not seen") +def test_dbus_old_network_set(dev, apdev): + """The old D-Bus interface and network set method""" + (bus,wpas_obj,path,if_obj) = prepare_dbus(dev[0]) + + path = if_obj.addNetwork(dbus_interface=WPAS_DBUS_OLD_IFACE) + netw_obj = bus.get_object(WPAS_DBUS_OLD_SERVICE, path) + netw_obj.disable(dbus_interface=WPAS_DBUS_OLD_NETWORK) + + params = dbus.Dictionary({ 'priority': dbus.UInt64(1) }, signature='sv') + try: + netw_obj.set(params, dbus_interface=WPAS_DBUS_OLD_NETWORK) + raise Exception("set succeeded with unexpected type") + except dbus.exceptions.DBusException, e: + if "InvalidOptions" not in str(e): + raise Exception("Unexpected error message for unexpected type: " + str(e)) + def test_dbus_old_wps_pbc(dev, apdev): """The old D-Bus interface and WPS/PBC""" try: