1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00
Files
jc/tests/test_postconf.py
Kelly Brazil c8720b259c optimize tests
2022-09-23 14:02:27 -07:00

35 lines
935 B
Python

import os
import unittest
import json
import jc.parsers.postconf
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/generic/postconf-M.out'), 'r', encoding='utf-8') as f:
generic_postconf_m = f.read()
# output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/postconf-M.json'), 'r', encoding='utf-8') as f:
generic_postconf_m_json = json.loads(f.read())
def test_postconf_nodata(self):
"""
Test 'postconf' with no data
"""
self.assertEqual(jc.parsers.postconf.parse('', quiet=True), [])
def test_postconf(self):
"""
Test 'postconf -M'
"""
self.assertEqual(jc.parsers.postconf.parse(self.generic_postconf_m, quiet=True), self.generic_postconf_m_json)
if __name__ == '__main__':
unittest.main()