1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-08-08 22:36:48 +02:00

add postconf tests

This commit is contained in:
Kelly Brazil
2022-06-15 09:22:09 -07:00
parent 45f45e0511
commit 247c43278c
2 changed files with 36 additions and 0 deletions

File diff suppressed because one or more lines are too long

35
tests/test_postconf.py Normal file
View File

@ -0,0 +1,35 @@
import os
import unittest
import json
import jc.parsers.postconf
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
class MyTests(unittest.TestCase):
def setUp(self):
# input
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/postconf-M.out'), 'r', encoding='utf-8') as f:
self.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:
self.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()