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

fix for no data

This commit is contained in:
Kelly Brazil
2020-06-10 17:54:06 -07:00
parent 06811c3539
commit cad6dde4ac
10 changed files with 60 additions and 0 deletions

View File

@ -29,6 +29,12 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/group.json'), 'r', encoding='utf-8') as f: with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/group.json'), 'r', encoding='utf-8') as f:
self.osx_10_14_6_group_json = json.loads(f.read()) self.osx_10_14_6_group_json = json.loads(f.read())
def test_group_nodata(self):
"""
Test 'cat /etc/group' with no data
"""
self.assertEqual(jc.parsers.group.parse('', quiet=True), [])
def test_group_centos_7_7(self): def test_group_centos_7_7(self):
""" """
Test 'cat /etc/group' on Centos 7.7 Test 'cat /etc/group' on Centos 7.7

View File

@ -23,6 +23,12 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/gshadow.json'), 'r', encoding='utf-8') as f: with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/gshadow.json'), 'r', encoding='utf-8') as f:
self.ubuntu_18_4_gshadow_json = json.loads(f.read()) self.ubuntu_18_4_gshadow_json = json.loads(f.read())
def test_gshadow_nodata(self):
"""
Test 'cat /etc/gshadow' with no data
"""
self.assertEqual(jc.parsers.gshadow.parse('', quiet=True), [])
def test_gshadow_centos_7_7(self): def test_gshadow_centos_7_7(self):
""" """
Test 'cat /etc/gshadow' on Centos 7.7 Test 'cat /etc/gshadow' on Centos 7.7

View File

@ -23,6 +23,12 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/history.json'), 'r', encoding='utf-8') as f: with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/history.json'), 'r', encoding='utf-8') as f:
self.ubuntu_18_4_history_json = json.loads(f.read()) self.ubuntu_18_4_history_json = json.loads(f.read())
def test_history_nodata(self):
"""
Test 'history' with no data
"""
self.assertEqual(jc.parsers.history.parse('', quiet=True), [])
def test_history_centos_7_7(self): def test_history_centos_7_7(self):
""" """
Test 'history' on Centos 7.7 Test 'history' on Centos 7.7

View File

@ -23,6 +23,12 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/hosts.json'), 'r', encoding='utf-8') as f: with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/hosts.json'), 'r', encoding='utf-8') as f:
self.ubuntu_18_4_hosts_json = json.loads(f.read()) self.ubuntu_18_4_hosts_json = json.loads(f.read())
def test_hosts_nodata(self):
"""
Test 'cat /etc/hosts' with no data
"""
self.assertEqual(jc.parsers.hosts.parse('', quiet=True), [])
def test_hosts_centos_7_7(self): def test_hosts_centos_7_7(self):
""" """
Test 'cat /etc/hosts' on Centos 7.7 Test 'cat /etc/hosts' on Centos 7.7

View File

@ -23,6 +23,12 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/id.json'), 'r', encoding='utf-8') as f: with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/id.json'), 'r', encoding='utf-8') as f:
self.osx_10_14_6_id_json = json.loads(f.read()) self.osx_10_14_6_id_json = json.loads(f.read())
def test_id_nodata(self):
"""
Test 'id' with no data
"""
self.assertEqual(jc.parsers.id.parse('', quiet=True), {})
def test_id_centos_7_7(self): def test_id_centos_7_7(self):
""" """
Test 'id' on Centos 7.7 Test 'id' on Centos 7.7

View File

@ -47,6 +47,12 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/ifconfig2.json'), 'r', encoding='utf-8') as f: with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/ifconfig2.json'), 'r', encoding='utf-8') as f:
self.osx_10_14_6_ifconfig2_json = json.loads(f.read()) self.osx_10_14_6_ifconfig2_json = json.loads(f.read())
def test_ifconfig_nodata(self):
"""
Test 'ifconfig' with no data
"""
self.assertEqual(jc.parsers.ifconfig.parse('', quiet=True), [])
def test_ifconfig_centos_7_7(self): def test_ifconfig_centos_7_7(self):
""" """
Test 'ifconfig' on Centos 7.7 Test 'ifconfig' on Centos 7.7

View File

@ -23,6 +23,12 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/ini-iptelserver.json'), 'r', encoding='utf-8') as f: with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/ini-iptelserver.json'), 'r', encoding='utf-8') as f:
self.generic_ini_iptelserver_json = json.loads(f.read()) self.generic_ini_iptelserver_json = json.loads(f.read())
def test_ini_nodata(self):
"""
Test the test ini file with no data
"""
self.assertEqual(jc.parsers.ini.parse('', quiet=True), {})
def test_ini_test(self): def test_ini_test(self):
""" """
Test the test ini file Test the test ini file

View File

@ -83,6 +83,12 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/iptables-raw.json'), 'r', encoding='utf-8') as f: with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/iptables-raw.json'), 'r', encoding='utf-8') as f:
self.ubuntu_18_4_iptables_raw_json = json.loads(f.read()) self.ubuntu_18_4_iptables_raw_json = json.loads(f.read())
def test_iptables_nodata(self):
"""
Test 'sudo iptables' with no data
"""
self.assertEqual(jc.parsers.iptables.parse('', quiet=True), [])
def test_iptables_filter_centos_7_7(self): def test_iptables_filter_centos_7_7(self):
""" """
Test 'sudo iptables -L -t filter' on Centos 7.7 Test 'sudo iptables -L -t filter' on Centos 7.7

View File

@ -23,6 +23,12 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/jobs.json'), 'r', encoding='utf-8') as f: with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/jobs.json'), 'r', encoding='utf-8') as f:
self.ubuntu_18_4_jobs_json = json.loads(f.read()) self.ubuntu_18_4_jobs_json = json.loads(f.read())
def test_jobs_nodata(self):
"""
Test 'jobs' with no data
"""
self.assertEqual(jc.parsers.jobs.parse('', quiet=True), [])
def test_jobs_centos_7_7(self): def test_jobs_centos_7_7(self):
""" """
Test 'jobs' on Centos 7.7 Test 'jobs' on Centos 7.7

View File

@ -65,6 +65,12 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/last.json'), 'r', encoding='utf-8') as f: with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/last.json'), 'r', encoding='utf-8') as f:
self.freebsd12_last_json = json.loads(f.read()) self.freebsd12_last_json = json.loads(f.read())
def test_last_nodata(self):
"""
Test plain 'last' with no data
"""
self.assertEqual(jc.parsers.last.parse('', quiet=True), [])
def test_last_centos_7_7(self): def test_last_centos_7_7(self):
""" """
Test plain 'last' on Centos 7.7 Test plain 'last' on Centos 7.7