mirror of
https://gitlab.freedesktop.org/upower/power-profiles-daemon.git
synced 2026-05-05 11:08:01 +02:00
tests: Add test for HoldProfile when not authorised
This commit is contained in:
parent
141d2ee64f
commit
393cb81aa8
1 changed files with 16 additions and 0 deletions
|
|
@ -778,6 +778,22 @@ class Tests(dbusmock.DBusTestCase):
|
|||
|
||||
self.stop_daemon()
|
||||
|
||||
def test_not_allowed_hold(self):
|
||||
'''Check that we get an error when trying to hold a profile and not allowed'''
|
||||
|
||||
self.obj_polkit.SetAllowed(dbus.Array([], signature='s'))
|
||||
self.start_daemon()
|
||||
self.assertEqual(self.get_dbus_property('ActiveProfile'), 'balanced')
|
||||
|
||||
with self.assertRaises(gi.repository.GLib.GError) as cm:
|
||||
self.call_dbus_method('HoldProfile', GLib.Variant("(sss)", ('performance', '', '')))
|
||||
self.assertIn('AccessDenied', str(cm.exception))
|
||||
|
||||
self.assertEqual(self.get_dbus_property('ActiveProfile'), 'balanced')
|
||||
self.assertEqual(len(self.get_dbus_property('ActiveProfileHolds')), 0)
|
||||
|
||||
self.stop_daemon()
|
||||
|
||||
#
|
||||
# Helper methods
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue