mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2025-12-25 01:00:03 +01:00
tests: Add a test case for batteries with zero power draw
Make sure that the issue reported in #7 and #44 is fixed. The mocked battery has a zero power_now attribute and a non-zero legacy current_now attribute on purpose, to detect if upowerd tries to read current_now if the power_now value is small.
This commit is contained in:
parent
2949136b15
commit
b64902eed2
1 changed files with 22 additions and 0 deletions
|
|
@ -833,6 +833,28 @@ class Tests(dbusmock.DBusTestCase):
|
|||
self.assertEqual(self.get_dbus_display_property('IsPresent'), True)
|
||||
self.stop_daemon()
|
||||
|
||||
def test_battery_zero_power_draw(self):
|
||||
'''Battery with zero power draw, e.g. in a dual-battery system'''
|
||||
|
||||
self.testbed.add_device('power_supply', 'BAT0', None,
|
||||
['type', 'Battery',
|
||||
'present', '1',
|
||||
'status', 'Full',
|
||||
'energy_full', '60000000',
|
||||
'energy_full_design', '80000000',
|
||||
'energy_now', '60000000',
|
||||
'voltage_now', '12000000',
|
||||
'power_now', '0',
|
||||
'current_now', '787000'], [])
|
||||
|
||||
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, 'EnergyRate'), 0.0)
|
||||
self.stop_daemon()
|
||||
|
||||
def test_ups_no_ac(self):
|
||||
'''UPS properties without AC'''
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue