1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-13 01:20:24 +02:00

add more bsd tests

This commit is contained in:
Kelly Brazil
2022-11-06 12:12:07 -08:00
parent 0144863d33
commit 644d3f350d
4 changed files with 33 additions and 9 deletions

View File

@ -0,0 +1 @@
[{"name":"cxl3","flags":8843,"state":["UP","BROADCAST","RUNNING","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"00:07:43:3d:b7:70","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":0,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"hw_address":"00:07:43:3d:b7:88","media":"Ethernet 10Gbase-LR","media_flags":["full-duplex","rxpause","txpause"],"status":"active","nd6_options":29,"nd6_flags":["PERFORMNUD","IFDISABLED","AUTO_LINKLOCAL"],"plugged":"SFP/SFP+/SFP28 10G Base-LR (LC)","vendor":"INNOLIGHT","vendor_pn":"TR-PX13L-N00","vendor_sn":"INJBL0431986","vendor_date":"2020-01-04","module_temperature":"21.20 C","module_voltage":"3.16 Volts"}]

View File

@ -0,0 +1 @@
[{"name":"ix0","flags":8843,"state":["UP","BROADCAST","RUNNING","SIMPLEX","MULTICAST"],"mtu":9000,"type":null,"mac_addr":"00:1b:21:8b:f8:2c","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":0,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"media":"Ethernet autoselect (10Gbase-SR","media_flags":["full-duplex","rxpause","txpause"],"status":"active","nd6_options":29,"nd6_flags":["PERFORMNUD","IFDISABLED","AUTO_LINKLOCAL"],"plugged":"SFP/SFP+/SFP28 10G Base-SR (LC)","vendor":"Intel Corp","vendor_pn":"FTLX8571D3BCV-IT","vendor_sn":"ALH1AV9","vendor_date":"2011-10-27","module_temperature":"51.27 C","module_voltage":"3.31 Volts","rx_power":"0.49 mW (-3.02 dBm)","tx_pwer":"0.66 mW (-1.74 dBm)"}]

View File

@ -0,0 +1 @@
[{"name":"cxl3","flags":8843,"state":["UP","BROADCAST","RUNNING","SIMPLEX","MULTICAST"],"mtu":1500,"type":null,"mac_addr":"00:07:43:3d:b7:70","ipv4_addr":null,"ipv4_mask":null,"ipv4_bcast":null,"ipv6_addr":null,"ipv6_mask":null,"ipv6_scope":null,"ipv6_type":null,"metric":0,"rx_packets":null,"rx_errors":null,"rx_dropped":null,"rx_overruns":null,"rx_frame":null,"tx_packets":null,"tx_errors":null,"tx_dropped":null,"tx_overruns":null,"tx_carrier":null,"tx_collisions":null,"rx_bytes":null,"tx_bytes":null,"hw_address":"00:07:43:3d:b7:88","media":null,"media_flags":null,"status":"active","nd6_options":29,"nd6_flags":["PERFORMNUD","IFDISABLED","AUTO_LINKLOCAL"],"plugged":"SFP/SFP+/SFP28 10G Base-LR (LC)","vendor":"INNOLIGHT","vendor_pn":"TR-PX13L-N00","vendor_sn":"INJBL0431986","vendor_date":"2020-01-04","module_temperature":"21.20 C","module_voltage":"3.16 Volts"}]

View File

@ -27,6 +27,15 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/ifconfig2.out'), 'r', encoding='utf-8') as f: with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/ifconfig2.out'), 'r', encoding='utf-8') as f:
osx_10_14_6_ifconfig2 = f.read() osx_10_14_6_ifconfig2 = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/ifconfig-extra-fields.out'), 'r', encoding='utf-8') as f:
osx_freebsd12_ifconfig_extra_fields = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/ifconfig-extra-fields2.out'), 'r', encoding='utf-8') as f:
osx_freebsd12_ifconfig_extra_fields2 = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/ifconfig-extra-fields3.out'), 'r', encoding='utf-8') as f:
osx_freebsd12_ifconfig_extra_fields3 = f.read()
# output # output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/ifconfig.json'), 'r', encoding='utf-8') as f: with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/ifconfig.json'), 'r', encoding='utf-8') as f:
centos_7_7_ifconfig_json = json.loads(f.read()) centos_7_7_ifconfig_json = json.loads(f.read())
@ -46,6 +55,15 @@ 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:
osx_10_14_6_ifconfig2_json = json.loads(f.read()) osx_10_14_6_ifconfig2_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/ifconfig-extra-fields.json'), 'r', encoding='utf-8') as f:
freebsd12_ifconfig_extra_fields_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/ifconfig-extra-fields2.json'), 'r', encoding='utf-8') as f:
freebsd12_ifconfig_extra_fields2_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/ifconfig-extra-fields3.json'), 'r', encoding='utf-8') as f:
freebsd12_ifconfig_extra_fields3_json = json.loads(f.read())
def test_ifconfig_nodata(self): def test_ifconfig_nodata(self):
""" """
Test 'ifconfig' with no data Test 'ifconfig' with no data
@ -56,52 +74,55 @@ class MyTests(unittest.TestCase):
""" """
Test 'ifconfig' on Centos 7.7 Test 'ifconfig' on Centos 7.7
""" """
self.maxDiff = None
self.assertEqual(jc.parsers.ifconfig.parse(self.centos_7_7_ifconfig, quiet=True), self.centos_7_7_ifconfig_json) self.assertEqual(jc.parsers.ifconfig.parse(self.centos_7_7_ifconfig, quiet=True), self.centos_7_7_ifconfig_json)
def test_ifconfig_ubuntu_18_4(self): def test_ifconfig_ubuntu_18_4(self):
""" """
Test 'ifconfig' on Ubuntu 18.4 Test 'ifconfig' on Ubuntu 18.4
""" """
self.maxDiff = None
self.assertEqual(jc.parsers.ifconfig.parse(self.ubuntu_18_4_ifconfig, quiet=True), self.ubuntu_18_4_ifconfig_json) self.assertEqual(jc.parsers.ifconfig.parse(self.ubuntu_18_4_ifconfig, quiet=True), self.ubuntu_18_4_ifconfig_json)
def test_ifconfig_osx_10_11_6(self): def test_ifconfig_osx_10_11_6(self):
""" """
Test 'ifconfig' on OSX 10.11.6 Test 'ifconfig' on OSX 10.11.6
""" """
self.maxDiff = None
self.assertEqual(jc.parsers.ifconfig.parse(self.osx_10_11_6_ifconfig, quiet=True), self.osx_10_11_6_ifconfig_json) self.assertEqual(jc.parsers.ifconfig.parse(self.osx_10_11_6_ifconfig, quiet=True), self.osx_10_11_6_ifconfig_json)
def test_ifconfig_osx_10_11_6_2(self): def test_ifconfig_osx_10_11_6_2(self):
""" """
Test 'ifconfig' on OSX 10.11.6 Test 'ifconfig' on OSX 10.11.6
""" """
self.maxDiff = None
self.assertEqual(jc.parsers.ifconfig.parse(self.osx_10_11_6_ifconfig2, quiet=True), self.osx_10_11_6_ifconfig2_json) self.assertEqual(jc.parsers.ifconfig.parse(self.osx_10_11_6_ifconfig2, quiet=True), self.osx_10_11_6_ifconfig2_json)
def test_ifconfig_osx_10_14_6(self): def test_ifconfig_osx_10_14_6(self):
""" """
Test 'ifconfig' on OSX 10.14.6 Test 'ifconfig' on OSX 10.14.6
""" """
self.maxDiff = None
self.assertEqual(jc.parsers.ifconfig.parse(self.osx_10_14_6_ifconfig, quiet=True), self.osx_10_14_6_ifconfig_json) self.assertEqual(jc.parsers.ifconfig.parse(self.osx_10_14_6_ifconfig, quiet=True), self.osx_10_14_6_ifconfig_json)
def test_ifconfig_osx_10_14_6_2(self): def test_ifconfig_osx_10_14_6_2(self):
""" """
Test 'ifconfig' on OSX 10.14.6 Test 'ifconfig' on OSX 10.14.6
""" """
self.maxDiff = None
self.assertEqual(jc.parsers.ifconfig.parse(self.osx_10_14_6_ifconfig2, quiet=True), self.osx_10_14_6_ifconfig2_json) self.assertEqual(jc.parsers.ifconfig.parse(self.osx_10_14_6_ifconfig2, quiet=True), self.osx_10_14_6_ifconfig2_json)
def test_ifconfig_freebsd_extra_fields(self): def test_ifconfig_freebsd_extra_fields(self):
pass """
Test 'ifconfig' on freebsd12
"""
self.assertEqual(jc.parsers.ifconfig.parse(self.osx_freebsd12_ifconfig_extra_fields, quiet=True), self.freebsd12_ifconfig_extra_fields_json)
def test_ifconfig_freebsd_extra_fields2(self): def test_ifconfig_freebsd_extra_fields2(self):
pass """
Test 'ifconfig' on freebsd12 with other fields
"""
self.assertEqual(jc.parsers.ifconfig.parse(self.osx_freebsd12_ifconfig_extra_fields2, quiet=True), self.freebsd12_ifconfig_extra_fields2_json)
def test_ifconfig_freebsd_extra_fields3(self): def test_ifconfig_freebsd_extra_fields3(self):
pass """
Test 'ifconfig' on freebsd12 with other extra fields
"""
self.assertEqual(jc.parsers.ifconfig.parse(self.osx_freebsd12_ifconfig_extra_fields3, quiet=True), self.freebsd12_ifconfig_extra_fields3_json)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()