mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
add tests for fix to make the file parser splitting more robust
This commit is contained in:
@ -19,6 +19,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/file.out'), 'r', encoding='utf-8') as f:
|
||||
self.osx_10_14_6_file = f.read()
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/file2.out'), 'r', encoding='utf-8') as f:
|
||||
self.osx_10_14_6_file2 = f.read()
|
||||
|
||||
# output
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/file.json'), 'r', encoding='utf-8') as f:
|
||||
self.centos_7_7_file_json = json.loads(f.read())
|
||||
@ -29,6 +32,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/file.json'), 'r', encoding='utf-8') as f:
|
||||
self.osx_10_14_6_file_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/file2.json'), 'r', encoding='utf-8') as f:
|
||||
self.osx_10_14_6_file2_json = json.loads(f.read())
|
||||
|
||||
def test_file_centos_7_7(self):
|
||||
"""
|
||||
Test 'file *' on Centos 7.7
|
||||
@ -47,6 +53,12 @@ class MyTests(unittest.TestCase):
|
||||
"""
|
||||
self.assertEqual(jc.parsers.file.parse(self.osx_10_14_6_file, quiet=True), self.osx_10_14_6_file_json)
|
||||
|
||||
def test_file2_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'file *' with filetpe descriptions including colons on OSX 10.14.6
|
||||
"""
|
||||
self.assertEqual(jc.parsers.file.parse(self.osx_10_14_6_file2, quiet=True), self.osx_10_14_6_file2_json)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Reference in New Issue
Block a user