integration-test: Test mapping pending-charge to fully-charged

parent a9534014
Pipeline #15939 passed with stage
in 9 minutes and 3 seconds
......@@ -597,6 +597,31 @@ class Tests(dbusmock.DBusTestCase):
self.assertEqual(self.get_dbus_display_property('State'), UP_DEVICE_STATE_CHARGING)
self.stop_daemon()
def test_map_pending_charge_to_fully_charged(self):
'''Map pending-charge to fully-charged'''
bat0 = self.testbed.add_device('power_supply', 'BAT0', None,
['type', 'Battery',
'present', '1',
'status', 'Not charging',
'charge_full', '10500000',
'charge_full_design', '11000000',
'capacity', '100',
'voltage_now', '12000000'], [])
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, 'State'), UP_DEVICE_STATE_FULLY_CHARGED)
self.stop_daemon()
# and make sure we still return pending-charge below 100%
self.testbed.set_attribute(bat0, 'capacity', '99')
self.start_daemon()
self.assertEqual(self.get_dbus_dev_property(bat0_up, 'State'), UP_DEVICE_STATE_PENDING_CHARGE)
self.stop_daemon()
def test_battery_charge(self):
'''battery which reports charge instead of energy
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment