mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-08 20:03:34 +02:00
tests: Add dbus-monitor'ing to PAM tests
Should prove useful debugging the PAM module if we need it.
This commit is contained in:
@ -33,9 +33,31 @@ PAM_USER_UNKNOWN = 10
|
||||
class TestPamFprintd(dbusmock.DBusTestCase):
|
||||
'''Test pam_fprintd'''
|
||||
|
||||
@classmethod
|
||||
def start_monitor(klass):
|
||||
'''Start dbus-monitor'''
|
||||
|
||||
workdir = os.environ['TOPBUILDDIR'] + '/tests/pam/'
|
||||
klass.monitor_log = open(os.path.join(workdir, 'dbus-monitor.log'), 'wb', buffering=0)
|
||||
klass.monitor = subprocess.Popen(['dbus-monitor', '--monitor', '--system'],
|
||||
stdout=klass.monitor_log,
|
||||
stderr=subprocess.STDOUT)
|
||||
|
||||
@classmethod
|
||||
def stop_monitor(klass):
|
||||
'''Stop dbus-monitor'''
|
||||
|
||||
assert klass.monitor
|
||||
klass.monitor.terminate()
|
||||
klass.monitor.wait()
|
||||
|
||||
klass.monitor_log.flush()
|
||||
klass.monitor_log.close()
|
||||
|
||||
@classmethod
|
||||
def setUpClass(klass):
|
||||
klass.start_system_bus()
|
||||
klass.start_monitor()
|
||||
klass.dbus_con = klass.get_dbus(True)
|
||||
|
||||
template_path = './'
|
||||
@ -44,6 +66,10 @@ class TestPamFprintd(dbusmock.DBusTestCase):
|
||||
klass.template_name = template_path + 'dbusmock/fprintd.py'
|
||||
print ('Using template from %s' % klass.template_name)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(klass):
|
||||
klass.stop_monitor()
|
||||
|
||||
def setUp(self):
|
||||
(self.p_mock, self.obj_fprintd_manager) = self.spawn_server_template(
|
||||
self.template_name, {}, stdout=subprocess.PIPE)
|
||||
|
||||
Reference in New Issue
Block a user