1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2026-04-26 21:04:16 +02:00

initial add du parser

This commit is contained in:
Kelly Brazil
2019-12-16 13:52:42 -08:00
parent 3a3016adb6
commit e882bf55bc
7 changed files with 8755 additions and 0 deletions
File diff suppressed because one or more lines are too long
+5199
View File
File diff suppressed because it is too large Load Diff
+3364
View File
File diff suppressed because it is too large Load Diff
+40
View File
@@ -0,0 +1,40 @@
import os
import json
import unittest
import jc.parsers.du
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/centos-7.7/du.out'), 'r') as f:
self.centos_7_7_du = f.read()
# with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/du.out'), 'r') as f:
# self.ubuntu_18_4_du = f.read()
# output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/du.json'), 'r') as f:
self.centos_7_7_du_json = json.loads(f.read())
# with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/du.json'), 'r') as f:
# self.ubuntu_18_4_du_json = json.loads(f.read())
def test_du_centos_7_7(self):
"""
Test 'du' on Centos 7.7
"""
self.assertEqual(jc.parsers.du.parse(self.centos_7_7_du, quiet=True), self.centos_7_7_du_json)
# def test_du_ubuntu_18_4(self):
# """
# Test 'du' on Ubuntu 18.4
# """
# self.assertEqual(jc.parsers.du.parse(self.ubuntu_18_4_du, quiet=True), self.ubuntu_18_4_du_json)
if __name__ == '__main__':
unittest.main()