tests: Start mock polkitd in the tests
And allow all us to perform all the actions.
This commit is contained in:
@@ -108,6 +108,9 @@ class Tests(dbusmock.DBusTestCase):
|
|||||||
The testbed is initially empty.
|
The testbed is initially empty.
|
||||||
'''
|
'''
|
||||||
self.testbed = UMockdev.Testbed.new()
|
self.testbed = UMockdev.Testbed.new()
|
||||||
|
self.polkitd, obj_polkit = self.spawn_server_template(
|
||||||
|
'polkitd', {}, stdout=subprocess.PIPE)
|
||||||
|
obj_polkit.SetAllowed(['net.hadess.SensorProxy.claim-sensor'])
|
||||||
|
|
||||||
self.proxy = None
|
self.proxy = None
|
||||||
self.log = None
|
self.log = None
|
||||||
@@ -117,6 +120,14 @@ class Tests(dbusmock.DBusTestCase):
|
|||||||
del self.testbed
|
del self.testbed
|
||||||
self.stop_daemon()
|
self.stop_daemon()
|
||||||
|
|
||||||
|
if self.polkitd:
|
||||||
|
try:
|
||||||
|
self.polkitd.kill()
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
self.polkitd.wait()
|
||||||
|
self.polkitd = None
|
||||||
|
|
||||||
# on failures, print daemon log
|
# on failures, print daemon log
|
||||||
errors = [x[1] for x in self._outcome.errors if x[1]]
|
errors = [x[1] for x in self._outcome.errors if x[1]]
|
||||||
if errors and self.log:
|
if errors and self.log:
|
||||||
|
Reference in New Issue
Block a user