mirror of
https://gitlab.freedesktop.org/upower/power-profiles-daemon.git
synced 2026-05-05 11:08:01 +02:00
tests: Add HP WMI test
This commit is contained in:
parent
2095f03c8c
commit
4c86f30cda
1 changed files with 26 additions and 0 deletions
|
|
@ -519,6 +519,32 @@ class Tests(dbusmock.DBusTestCase):
|
|||
|
||||
self.stop_daemon()
|
||||
|
||||
def test_hp_wmi(self):
|
||||
|
||||
# Uses cool instead of low-power
|
||||
acpi_dir = os.path.join(self.testbed.get_root_dir(), "sys/firmware/acpi/")
|
||||
os.makedirs(acpi_dir)
|
||||
with open(os.path.join(acpi_dir, "platform_profile") ,'w') as profile:
|
||||
profile.write("cool\n")
|
||||
with open(os.path.join(acpi_dir, "platform_profile_choices") ,'w') as choices:
|
||||
choices.write("cool balanced performance\n")
|
||||
|
||||
self.start_daemon()
|
||||
profiles = self.get_dbus_property('Profiles')
|
||||
self.assertEqual(len(profiles), 3)
|
||||
self.assertEqual(profiles[0]['Driver'], 'platform_profile')
|
||||
self.assertEqual(profiles[0]['Profile'], 'power-saver')
|
||||
self.assertEqual(self.get_dbus_property('ActiveProfile'), 'power-saver')
|
||||
self.assertEqual(self.read_file (os.path.join(self.testbed.get_root_dir(), "sys/firmware/acpi/platform_profile")), b'cool\n')
|
||||
|
||||
# Check that we can set the power-saver/cool profile again
|
||||
self.set_dbus_property('ActiveProfile', GLib.Variant.new_string('balanced'))
|
||||
self.set_dbus_property('ActiveProfile', GLib.Variant.new_string('power-saver'))
|
||||
self.assertEqual(self.get_dbus_property('ActiveProfile'), 'power-saver')
|
||||
self.assertEqual(self.read_file (os.path.join(self.testbed.get_root_dir(), "sys/firmware/acpi/platform_profile")), b'cool')
|
||||
|
||||
self.stop_daemon()
|
||||
|
||||
#
|
||||
# Helper methods
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue