mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
add test for acpi fix for never fully discharge state
This commit is contained in:
1
tests/fixtures/generic/acpi-V-never-fully-discharge.json
vendored
Normal file
1
tests/fixtures/generic/acpi-V-never-fully-discharge.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[{"type":"Battery","id":0,"state":"Discharging","charge_percent":87,"design_capacity_mah":2110,"last_full_capacity":2271,"last_full_capacity_percent":100},{"type":"Battery","id":1,"state":"Discharging","charge_percent":98,"charge_remaining":"01:43:14","design_capacity_mah":4400,"last_full_capacity":3013,"last_full_capacity_percent":68,"charge_remaining_hours":1,"charge_remaining_minutes":43,"charge_remaining_seconds":14,"charge_remaining_total_seconds":6194},{"type":"Battery","id":2,"state":"Discharging","charge_percent":0},{"type":"Battery","id":3,"state":"Full","charge_percent":100},{"type":"Adapter","id":0,"on-line":true},{"type":"Adapter","id":1,"on-line":false},{"type":"Thermal","id":0,"mode":"ok","temperature":46.0,"temperature_unit":"C","trip_points":[{"id":0,"switches_to_mode":"critical","temperature":127.0,"temperature_unit":"C"},{"id":1,"switches_to_mode":"hot","temperature":127.0,"temperature_unit":"C"}]},{"type":"Thermal","id":1,"mode":"ok","temperature":55.0,"temperature_unit":"C","trip_points":[{"id":0,"switches_to_mode":"critical","temperature":130.0,"temperature_unit":"C"},{"id":1,"switches_to_mode":"hot","temperature":100.0,"temperature_unit":"C"}]},{"type":"Cooling","id":0,"messages":["Processor 0 of 10"]},{"type":"Cooling","id":1,"messages":["Processor 0 of 10"]},{"type":"Cooling","id":2,"messages":["x86_pkg_temp no state information available"]},{"type":"Cooling","id":3,"messages":["Processor 0 of 10"]},{"type":"Cooling","id":4,"messages":["intel_powerclamp no state information available","another message"]},{"type":"Cooling","id":5,"messages":["Processor 0 of 10"]}]
|
21
tests/fixtures/generic/acpi-V-never-fully-discharge.out
vendored
Normal file
21
tests/fixtures/generic/acpi-V-never-fully-discharge.out
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
Battery 0: Discharging, 87%, discharging at zero rate - will never fully discharge.
|
||||
Battery 0: design capacity 2110 mAh, last full capacity 2271 mAh = 100%
|
||||
Battery 1: Discharging, 98%, 01:43:14 remaining
|
||||
Battery 1: design capacity 4400 mAh, last full capacity 3013 mAh = 68%
|
||||
Battery 2: Discharging, 0%, rate information unavailable
|
||||
Battery 3: Full, 100%
|
||||
Adapter 0: on-line
|
||||
Adapter 1: off-line
|
||||
Thermal 0: ok, 46.0 degrees C
|
||||
Thermal 0: trip point 0 switches to mode critical at temperature 127.0 degrees C
|
||||
Thermal 0: trip point 1 switches to mode hot at temperature 127.0 degrees C
|
||||
Thermal 1: ok, 55.0 degrees C
|
||||
Thermal 1: trip point 0 switches to mode critical at temperature 130.0 degrees C
|
||||
Thermal 1: trip point 1 switches to mode hot at temperature 100.0 degrees C
|
||||
Cooling 0: Processor 0 of 10
|
||||
Cooling 1: Processor 0 of 10
|
||||
Cooling 2: x86_pkg_temp no state information available
|
||||
Cooling 3: Processor 0 of 10
|
||||
Cooling 4: intel_powerclamp no state information available
|
||||
Cooling 4: another message
|
||||
Cooling 5: Processor 0 of 10
|
@ -24,6 +24,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/acpi-V.out'), 'r', encoding='utf-8') as f:
|
||||
ubuntu_18_04_acpi_V = f.read()
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/acpi-V-never-fully-discharge.out'), 'r', encoding='utf-8') as f:
|
||||
acpi_V_never_fully_discharge = f.read()
|
||||
|
||||
# output
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/acpi-V.json'), 'r', encoding='utf-8') as f:
|
||||
generic_acpi_V_json = json.loads(f.read())
|
||||
@ -40,6 +43,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/acpi-V.json'), 'r', encoding='utf-8') as f:
|
||||
ubuntu_18_04_acpi_V_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/acpi-V-never-fully-discharge.json'), 'r', encoding='utf-8') as f:
|
||||
acpi_V_never_fully_discharge_json = json.loads(f.read())
|
||||
|
||||
def test_acpi_nodata(self):
|
||||
"""
|
||||
Test 'acpi' with no data
|
||||
@ -76,6 +82,12 @@ class MyTests(unittest.TestCase):
|
||||
"""
|
||||
self.assertEqual(jc.parsers.acpi.parse(self.ubuntu_18_04_acpi_V, quiet=True), self.ubuntu_18_04_acpi_V_json)
|
||||
|
||||
def test_acpi_V_never_fully_discharge(self):
|
||||
"""
|
||||
Test 'acpi -V' with "never fully discharge" message
|
||||
"""
|
||||
self.assertEqual(jc.parsers.acpi.parse(self.acpi_V_never_fully_discharge, quiet=True), self.acpi_V_never_fully_discharge_json)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Reference in New Issue
Block a user