1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00

add "sudo efibootmgr" (without -v) output test case (#534)

This commit is contained in:
yaofei zheng
2024-02-06 03:06:36 +08:00
committed by Kelly Brazil
parent bd6611aaba
commit 539fe72d16
6 changed files with 137 additions and 86 deletions

View File

@ -9,10 +9,16 @@ THIS_DIR = os.path.dirname(os.path.abspath(__file__))
class MyTests(unittest.TestCase):
# input
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/opensuse-leap-15.5/efibootmgr-v.out'), 'r', encoding='utf-8') as f:
opensuse_leap_15_5_efibootmgr_v = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/opensuse-leap-15.5/efibootmgr.out'), 'r', encoding='utf-8') as f:
opensuse_leap_15_5_efibootmgr = f.read()
# output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/opensuse-leap-15.5/efibootmgr-v.json'), 'r', encoding='utf-8') as f:
opensuse_leap_15_5_efibootmgr_json_v = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/opensuse-leap-15.5/efibootmgr.json'), 'r', encoding='utf-8') as f:
opensuse_leap_15_5_efibootmgr_json = json.loads(f.read())
@ -22,6 +28,12 @@ class MyTests(unittest.TestCase):
"""
self.assertEqual(jc.parsers.efibootmgr.parse('', quiet=True), [])
def test_efibootmgr_v_opensuse_leap_15_5(self):
"""
Test 'efibootmgr -v' on Opensuse Leap 15.5
"""
self.assertEqual(jc.parsers.efibootmgr.parse(self.opensuse_leap_15_5_efibootmgr_v, quiet=True), self.opensuse_leap_15_5_efibootmgr_json_v)
def test_efibootmgr_opensuse_leap_15_5(self):
"""
Test 'efibootmgr' on Opensuse Leap 15.5