1
0
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:
Kelly Brazil
2023-01-31 09:51:23 -08:00
parent 1d8f83b8c6
commit ec29b8bbc6
3 changed files with 34 additions and 0 deletions

View File

@ -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()