Commit 0ffdabeb authored by Christian Kellner's avatar Christian Kellner
Browse files

integration-test: extract battery testbed setup

parent 159fe437
......@@ -137,22 +137,27 @@ class Tests(unittest.TestCase):
return f.read()
return ""
def add_std_power_supply(self, vendor='GNOME.org', model='B1'):
ac = self.testbed.add_device('power_supply', 'AC', None,
['type', 'Mains', 'online', '0'], [])
b0 = self.testbed.add_device('power_supply', 'BAT0', None,
['type', 'Battery',
'manufacturer', vendor,
'model_name', model,
'present', '1',
'status', 'Discharging',
'energy_full', '60000000',
'energy_full_design', '80000000',
'energy_now', '48000000',
'voltage_now', '11000000'], [])
return ac, b0
def test_basic(self):
vendor = 'GNOME.org'
model = 'B1'
self.testbed.add_device('power_supply', 'AC', None,
['type', 'Mains', 'online', '0'], [])
self.testbed.add_device('power_supply', 'BAT0', None,
['type', 'Battery',
'manufacturer', vendor,
'model_name', model,
'present', '1',
'status', 'Discharging',
'energy_full', '60000000',
'energy_full_design', '80000000',
'energy_now', '48000000',
'voltage_now', '12000000'], [])
self.add_std_power_supply(vendor=vendor, model=model)
log = self.gbb("info", ["--json"])
out = json.loads(log)
......
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