Agent#

class pytest_bluezenv.Agent(capability='KeyboardDisplay', path='/agent')[source]#

Host plugin providing org.bluez.Agent1 test implementation.

Asynchronous events are handled via expect().

Parameters:
  • capability (str) – agent capability, e.g. "KeyboardDisplay".

  • path (str) – D-Bus object path to register the agent at.

Depends on Bluetoothd.

Example

host.agent.device_method(host1.bdaddr, "Pair")
event = host.agent.expect("org.bluez.Agent1.RequestConfirmation")
assert event.passkey == 1234
host.agent.reply()
__init__(capability='KeyboardDisplay', path='/agent')[source]#

Configure a plugin on the upper tester at collection time.

Methods

adapter_get(key)

Get given org.bluez.Adapter1 property

adapter_method(method, *a, **kw)

Call given org.bluez.Adapter1 DBus method.

adapter_set(key, value)

Set given org.bluez.Adapter1 property

device_get(address, key)

Get given org.bluez.Device1 property.

device_method(address, method, *a, **kw)

Call given org.bluez.Device1 DBus method.

device_set(address, key, value)

Set given org.bluez.Device1 property.

expect(kinds)

Get most recent pending Event and assert its kind.

get_event([block])

Get most recent pending Event, blocking optional.

has_device(address)

Return True if device with given address exists.

object_method(obj, method, *a, **kw)

Call DBus method of an object and handle reply as async events.

presetup(config)

Configure a plugin on the upper tester before VM hosts start.

reply(*value)

Provide a D-Bus reply to the most recent pending event.

reply_error([err])

Provide a D-Bus error reply to the most recent pending event.

setup(impl)

Register the org.bluez.Agent1 and make it the default agent (VM side).

teardown()

Unregister the agent (VM side).