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

add freebsd permanent and expires fields

This commit is contained in:
Kelly Brazil
2020-05-30 16:25:53 -07:00
parent 26994cdcb7
commit 35940d0bc8
6 changed files with 59 additions and 4 deletions

1
tests/fixtures/freebsd12/arp-a.json vendored Normal file
View File

@ -0,0 +1 @@
[{"name": null, "address": "192.168.71.163", "hwtype": "ethernet", "hwaddress": "00:0c:29:1a:4e:3b", "iface": "em0", "permanent": true}, {"name": null, "address": "192.168.71.2", "hwtype": "ethernet", "hwaddress": "00:50:56:f7:4a:fc", "iface": "em0", "permanent": false, "expires": 942}, {"name": null, "address": "192.168.71.1", "hwtype": "ethernet", "hwaddress": "00:50:56:c0:00:08", "iface": "em0", "permanent": false, "expires": 1182}]

3
tests/fixtures/freebsd12/arp-a.out vendored Normal file
View File

@ -0,0 +1,3 @@
? (192.168.71.163) at 00:0c:29:1a:4e:3b on em0 permanent [ethernet]
? (192.168.71.2) at 00:50:56:f7:4a:fc on em0 expires in 942 seconds [ethernet]
? (192.168.71.1) at 00:50:56:c0:00:08 on em0 expires in 1182 seconds [ethernet]

View File

@ -37,6 +37,9 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/arp-a2.out'), 'r', encoding='utf-8') as f:
self.osx_10_14_6_arp_a2 = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/arp-a.out'), 'r', encoding='utf-8') as f:
self.freebsd_arp_a = f.read()
# output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/arp.json'), 'r', encoding='utf-8') as f:
self.centos_7_7_arp_json = json.loads(f.read())
@ -65,6 +68,9 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/arp-a2.json'), 'r', encoding='utf-8') as f:
self.osx_10_14_6_arp_a2_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/arp-a.json'), 'r', encoding='utf-8') as f:
self.freebsd12_arp_a_json = json.loads(f.read())
def test_arp_centos_7_7(self):
"""
Test 'arp' on Centos 7.7
@ -119,6 +125,12 @@ class MyTests(unittest.TestCase):
"""
self.assertEqual(jc.parsers.arp.parse(self.osx_10_14_6_arp_a2, quiet=True), self.osx_10_14_6_arp_a2_json)
def test_arp_a_freebsd12(self):
"""
Test 'arp -a' on FreeBSD12
"""
self.assertEqual(jc.parsers.arp.parse(self.freebsd_arp_a, quiet=True), self.freebsd12_arp_a_json)
if __name__ == '__main__':
unittest.main()