Commit 6fb99616 authored by Christian Kellner's avatar Christian Kellner
Browse files

integration-test: test charge based monitoring

parent c5ea2b0e
......@@ -283,6 +283,38 @@ class Tests(unittest.TestCase):
self.assertEqual(b1['energy-full'], 54.9176)
self.assertEqual(b1['energy-full-design'], 54.34)
def test_charge_monitor(self):
self.testbed.add_device('power_supply', 'AC', None,
['type', 'Mains', 'online', '0'], [])
b0 = self.testbed.add_device('power_supply', 'BAT0', None,
['type', 'Battery',
'manufacturer', '',
'model_name', 'b1',
'present', '1',
'status', 'Discharging',
'charge_full', '7226000',
'charge_full_design', '7150000',
'charge_now', '7324000',
'voltage_min_design', '7600000'], [])
log = self.log()
self.assertIn('Monitoring power events', log)
self.testbed.set_attribute(b0, 'charge_now', '7000000')
self.assertIn('53.20 WH', log)
self.testbed.set_attribute(b0, 'charge_now', '6600000')
self.assertIn('50.16 WH', log)
self.testbed.set_attribute(b0, 'charge_now', '6000000')
self.assertIn('45.60 WH', log)
if __name__ == '__main__':
if 'umockdev' not in os.environ.get('LD_PRELOAD', ''):
Supports Markdown
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