mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-05 08:48:05 +02:00
linux: integration-test: Test exporting sysfs attributes
Add test for DBus exporting of the following sysfs attributes: 1. capacity_level 2. voltage_min_design 3. voltage_max_design Related: #301 Signed-off-by: Sicelo A. Mhlongo <absicsz@gmail.com>
This commit is contained in:
parent
240fa30ab5
commit
0f1506b61a
1 changed files with 40 additions and 0 deletions
|
|
@ -1151,6 +1151,46 @@ class Tests(dbusmock.DBusTestCase):
|
|||
)
|
||||
self.stop_daemon()
|
||||
|
||||
def test_kernel_capacity_level_and_voltage_min_max_exporting(self):
|
||||
"""Exporting capacity_level, voltage_{max,min}_design attributes"""
|
||||
|
||||
bat0 = self.testbed.add_device(
|
||||
"power_supply",
|
||||
"battery",
|
||||
None,
|
||||
[
|
||||
"type",
|
||||
"Battery",
|
||||
"voltage_min_design",
|
||||
"3100000",
|
||||
"voltage_max_design",
|
||||
"4200000",
|
||||
"charge_full_design",
|
||||
"1740000",
|
||||
"present",
|
||||
"1",
|
||||
"status",
|
||||
"Discharging",
|
||||
"voltage_now",
|
||||
"3750000",
|
||||
"capacity_level",
|
||||
"High",
|
||||
],
|
||||
[],
|
||||
)
|
||||
|
||||
self.start_daemon()
|
||||
devs = self.proxy.EnumerateDevices()
|
||||
self.assertEqual(len(devs), 1)
|
||||
bat0_up = devs[0]
|
||||
self.assertEqual(self.get_dbus_dev_property(bat0_up, "CapacityLevel"), "High")
|
||||
self.assertEqual(self.get_dbus_dev_property(bat0_up, "VoltageMinDesign"), 3.1)
|
||||
self.assertEqual(self.get_dbus_dev_property(bat0_up, "VoltageMaxDesign"), 4.2)
|
||||
self.testbed.set_attribute(bat0, "capacity_level", "Low")
|
||||
self.testbed.uevent(bat0, "change")
|
||||
self.assertEqual(self.get_dbus_dev_property(bat0_up, "CapacityLevel"), "Low")
|
||||
self.stop_daemon()
|
||||
|
||||
def test_empty_guessing(self):
|
||||
"""One empty batter not reporting a state"""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue