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

34 lines
1.0 KiB
Python
Raw Normal View History

import os
import json
import unittest
import jc.parsers.efibootmgr
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.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.json'), 'r', encoding='utf-8') as f:
opensuse_leap_15_5_efibootmgr_json = json.loads(f.read())
def test_efibootmgr_nodata(self):
"""
Test 'efibootmgr' with no data
"""
self.assertEqual(jc.parsers.efibootmgr.parse('', quiet=True), [])
def test_efibootmgr_opensuse_leap_15_5(self):
"""
Test 'efibootmgr' on Opensuse Leap 15.5
"""
self.assertEqual(jc.parsers.efibootmgr.parse(self.opensuse_leap_15_5_efibootmgr, quiet=True), self.opensuse_leap_15_5_efibootmgr_json)
if __name__ == '__main__':
unittest.main()