if "InvalidArgs" not in str(e):
raise Exception("Unexpected error message for invalid ServiceDiscoveryRequest(): " + str(e))
- args = {'foo': 'bar'}
- try:
- p2p.ServiceDiscoveryResponse(dbus.Dictionary(args, signature='sv'))
- raise Exception("Invalid ServiceDiscoveryResponse accepted")
- except dbus.exceptions.DBusException as e:
- if "InvalidArgs" not in str(e):
- raise Exception("Unexpected error message for invalid ServiceDiscoveryResponse(): " + str(e))
+ tests = [{'foo': 'bar'},
+ {'tlvs': dbus.ByteArray(b"\x02\x00\x00\x01"),
+ 'bar': 'foo'}]
+ for args in tests:
+ try:
+ p2p.ServiceDiscoveryResponse(dbus.Dictionary(args, signature='sv'))
+ raise Exception("Invalid ServiceDiscoveryResponse accepted")
+ except dbus.exceptions.DBusException as e:
+ if "InvalidArgs" not in str(e):
+ raise Exception("Unexpected error message for invalid ServiceDiscoveryResponse(): " + str(e))
def test_dbus_p2p_service_discovery_query(dev, apdev):
"""D-Bus P2P service discovery query"""