Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connection ¶
func Connection(handler DBusHandlerFunc) (*dbus.Conn, error)
Connection returns a DBus connection for writing unit tests.
The handler function is called for each message sent to the bus. It can return any number of messages to send in response.
func StubConnection ¶
StubConnection returns a dbus connection that does nothing.
Using dbustest.Connection panics as the goroutines spawned by go-dbus do not expect the connection to be immediately closed.
Types ¶
type DBusHandlerFunc ¶
DBusHandlerFunc is the type of handler function for interacting with test DBus.
The handler is called for each message that arrives to the bus from the test client. The handler can respond by returning zero or more messages. Typically one message is returned (method response or error). Additional messages can be returned to represent signals emitted during message handling. The counter n aids in testing a sequence of messages that is expected.
The handler is not called for internal messages related to DBus itself.
type InjectMessageFunc ¶
func InjectableConnection ¶
func InjectableConnection(handler DBusHandlerFunc) (*dbus.Conn, InjectMessageFunc, error)
InjectableConnection returns a DBus connection for writing unit tests and a function that can be used to inject messages that will be received by the test client.