tests: D-Bus RemoveClient()
Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
4e7175827e
commit
001c4bf5b3
1 changed files with 23 additions and 1 deletions
|
@ -2347,6 +2347,19 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||||
if "InvalidArgs" not in str(e):
|
if "InvalidArgs" not in str(e):
|
||||||
raise Exception("Unexpected error message for invalid RejectPeer(): " + str(e))
|
raise Exception("Unexpected error message for invalid RejectPeer(): " + str(e))
|
||||||
|
|
||||||
|
tests = [ { },
|
||||||
|
{ 'peer': 'foo' },
|
||||||
|
{ 'foo': "bar" },
|
||||||
|
{ 'iface': "abc" },
|
||||||
|
{ 'iface': 123 } ]
|
||||||
|
for t in tests:
|
||||||
|
try:
|
||||||
|
p2p.RemoveClient(t)
|
||||||
|
raise Exception("Invalid RemoveClient accepted")
|
||||||
|
except dbus.exceptions.DBusException, e:
|
||||||
|
if "InvalidArgs" not in str(e):
|
||||||
|
raise Exception("Unexpected error message for invalid RemoveClient(): " + str(e))
|
||||||
|
|
||||||
tests = [ {'DiscoveryType': 'foo'},
|
tests = [ {'DiscoveryType': 'foo'},
|
||||||
{'RequestedDeviceTypes': 'foo'},
|
{'RequestedDeviceTypes': 'foo'},
|
||||||
{'RequestedDeviceTypes': ['foo']},
|
{'RequestedDeviceTypes': ['foo']},
|
||||||
|
@ -3038,6 +3051,7 @@ def test_dbus_p2p_autogo(dev, apdev):
|
||||||
TestDbus.__init__(self, bus)
|
TestDbus.__init__(self, bus)
|
||||||
self.first = True
|
self.first = True
|
||||||
self.waiting_end = False
|
self.waiting_end = False
|
||||||
|
self.deauthorized = False
|
||||||
self.done = False
|
self.done = False
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
|
@ -3060,6 +3074,8 @@ def test_dbus_p2p_autogo(dev, apdev):
|
||||||
"ProvisionDiscoveryRequestDisplayPin")
|
"ProvisionDiscoveryRequestDisplayPin")
|
||||||
self.add_signal(self.staAuthorized, WPAS_DBUS_IFACE,
|
self.add_signal(self.staAuthorized, WPAS_DBUS_IFACE,
|
||||||
"StaAuthorized")
|
"StaAuthorized")
|
||||||
|
self.add_signal(self.staDeauthorized, WPAS_DBUS_IFACE,
|
||||||
|
"StaDeauthorized")
|
||||||
self.loop.run()
|
self.loop.run()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
@ -3235,11 +3251,17 @@ def test_dbus_p2p_autogo(dev, apdev):
|
||||||
if "Error.Failed" not in str(e):
|
if "Error.Failed" not in str(e):
|
||||||
raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e))
|
raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e))
|
||||||
|
|
||||||
|
p2p.RemoveClient({ 'peer': self.peer_path })
|
||||||
|
|
||||||
self.waiting_end = True
|
self.waiting_end = True
|
||||||
group_p2p = dbus.Interface(self.g_if_obj,
|
group_p2p = dbus.Interface(self.g_if_obj,
|
||||||
WPAS_DBUS_IFACE_P2PDEVICE)
|
WPAS_DBUS_IFACE_P2PDEVICE)
|
||||||
group_p2p.Disconnect()
|
group_p2p.Disconnect()
|
||||||
|
|
||||||
|
def staDeauthorized(self, name):
|
||||||
|
logger.debug("staDeauthorized: " + name)
|
||||||
|
self.deauthorized = True
|
||||||
|
|
||||||
def run_test(self, *args):
|
def run_test(self, *args):
|
||||||
logger.debug("run_test")
|
logger.debug("run_test")
|
||||||
params = dbus.Dictionary({'persistent': True,
|
params = dbus.Dictionary({'persistent': True,
|
||||||
|
@ -3249,7 +3271,7 @@ def test_dbus_p2p_autogo(dev, apdev):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def success(self):
|
def success(self):
|
||||||
return self.done
|
return self.done and self.deauthorized
|
||||||
|
|
||||||
with TestDbusP2p(bus) as t:
|
with TestDbusP2p(bus) as t:
|
||||||
if not t.success():
|
if not t.success():
|
||||||
|
|
Loading…
Add table
Reference in a new issue