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

add osx compatibility

This commit is contained in:
Kelly Brazil
2019-12-06 13:22:51 -08:00
parent 5e8c28a30a
commit 46b827da6b
7 changed files with 75 additions and 4 deletions

View File

@@ -28,6 +28,12 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/arp-v.out'), 'r') as f:
self.ubuntu_18_4_arp_v = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/arp-a.out'), 'r') as f:
self.osx_10_11_6_arp_a = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/arp-a.out'), 'r') as f:
self.osx_10_14_6_arp_a = f.read()
# output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/arp.json'), 'r') as f:
self.centos_7_7_arp_json = json.loads(f.read())
@@ -47,6 +53,12 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/arp-v.json'), 'r') as f:
self.ubuntu_18_4_arp_v_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/arp-a.json'), 'r') as f:
self.osx_10_11_6_arp_a_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/arp-a.json'), 'r') as f:
self.osx_10_14_6_arp_a_json = json.loads(f.read())
def test_arp_centos_7_7(self):
"""
Test 'arp' on Centos 7.7
@@ -83,6 +95,18 @@ class MyTests(unittest.TestCase):
"""
self.assertEqual(jc.parsers.arp.parse(self.ubuntu_18_4_arp_v, quiet=True), self.ubuntu_18_4_arp_v_json)
def test_arp_a_osx_10_11_6(self):
"""
Test 'arp -a' on OSX 10.11.6
"""
self.assertEqual(jc.parsers.arp.parse(self.osx_10_11_6_arp_a, quiet=True), self.osx_10_11_6_arp_a_json)
def test_arp_a_osx_10_14_6(self):
"""
Test 'arp -a' on OSX 10.14.6
"""
self.assertEqual(jc.parsers.arp.parse(self.osx_10_14_6_arp_a, quiet=True), self.osx_10_14_6_arp_a_json)
if __name__ == '__main__':
unittest.main()