mirror of
https://gitlab.freedesktop.org/upower/power-profiles-daemon.git
synced 2026-05-08 10:08:01 +02:00
trivial: integration tests: Add helpers for checking if actions enabled or disabled
This commit is contained in:
parent
9a69829ee1
commit
1b2c889b19
1 changed files with 20 additions and 0 deletions
|
|
@ -478,6 +478,26 @@ class Tests(dbusmock.DBusTestCase):
|
|||
+ f"'{self.get_dbus_property(prop)}'",
|
||||
)
|
||||
|
||||
def _assert_action_boolean(self, name, value):
|
||||
for action in self.get_dbus_property("Actions"):
|
||||
if action["Name"] != name:
|
||||
continue
|
||||
self.assertEqual(action["Enabled"], value)
|
||||
|
||||
def assert_action_disabled(self, name):
|
||||
"""Assert that a PPD action is disabled"""
|
||||
if self.PP_INTERFACE == "org.freedesktop.UPower.PowerProfiles":
|
||||
self._assert_action_boolean(name, False)
|
||||
else:
|
||||
self.assertNotIn(name, self.get_dbus_property("Actions"))
|
||||
|
||||
def assert_action_enabled(self, name):
|
||||
"""Assert that a PPD action is enabled"""
|
||||
if self.PP_INTERFACE == "org.freedesktop.UPower.PowerProfiles":
|
||||
self._assert_action_boolean(name, True)
|
||||
else:
|
||||
self.assertIn(name, self.get_dbus_property("Actions"))
|
||||
|
||||
#
|
||||
# Actual test cases
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue