# Path: dbusmock/mockobject.py
# MOCK_IFACE = 'org.freedesktop.DBus.Mock'


import time
import dbus
from dbusmock import MOCK_IFACE
    # default state
    mock.allow_unknown = False
    mock.allowed = []
    mock.delay = 0
    mock.simulate_hang = False
    mock.hanging_actions = []
    mock.hanging_calls = []


@dbus.service.method(MAIN_IFACE,
                     in_signature='(sa{sv})sa{ss}us',
                     out_signature='(bba{ss})',
                     async_callbacks=('ok_cb', '_err_cb'))
def CheckAuthorization(self, _subject, action_id, _details, _flags,
                       _cancellation_id, ok_cb, _err_cb):
    time.sleep(self.delay)
    allowed = action_id in self.allowed or self.allow_unknown
    ret = (allowed, False, {'test': 'test'})

    if self.simulate_hang or action_id in self.hanging_actions:
        self.hanging_calls.append((ok_cb, ret))
    else:
        ok_cb(ret)


@dbus.service.method(MAIN_IFACE, in_signature='(sa{sv})ss')
def RegisterAuthenticationAgent(_self, _subject, _locale, _object_path):
    pass



# Path: dbusmock/mockobject.py
# MOCK_IFACE = 'org.freedesktop.DBus.Mock'


# Path: dbusmock/templates/polkitd.py
import time
import dbus
from dbusmock import MOCK_IFACE

    # default state
    mock.allow_unknown = False
    mock.allowed = []
    mock.delay = 0
    mock.simulate_hang = False
    mock.hanging_actions = []
    mock.hanging_calls = []


@dbus.service.method(MAIN_IFACE,
                     in_signature='(sa{sv})sa{ss}us',
                     out_signature='(bba{ss})',
                     async_callbacks=('ok_cb', '_err_cb'))
def CheckAuthorization(self, _subject, action_id, _details, _flags,
                       _cancellation_id, ok_cb, _err_cb):
    time.sleep(self.delay)
    allowed = action_id in self.allowed or self.allow_unknown
    ret = (allowed, False, {'test': 'test'})

    if self.simulate_hang or action_id in self.hanging_actions:
        self.hanging_calls.append((ok_cb, ret))
    else:
        ok_cb(ret)


@dbus.service.method(MAIN_IFACE, in_signature='(sa{sv})ss')
def RegisterAuthenticationAgent(_self, _subject, _locale, _object_path):
    pass



@dbus.service.method(MOCK_IFACE, in_signature='b', out_signature='')