mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-15 01:24:29 +02:00
add ubuntu16 tests
This commit is contained in:
1
tests/fixtures/ubuntu-16.04/ifconfig.json
vendored
Normal file
1
tests/fixtures/ubuntu-16.04/ifconfig.json
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"name":"ens33","flags":null,"state":["UP BROADCAST RUNNING MULTICAST "],"mtu":1500,"type":"Ethernet","mac_addr":"00:0c:29:c2:c8:63","ipv4_addr":"192.168.248.129","ipv4_mask":"255.255.255.0","ipv4_bcast":"192.168.248.255","ipv6_addr":"fe80::c1ca:3dee:39f7:5937","ipv6_mask":64,"ipv6_scope":"Link","ipv6_type":null,"metric":1,"rx_packets":36,"rx_errors":0,"rx_dropped":0,"rx_overruns":0,"rx_frame":0,"tx_packets":152,"tx_errors":0,"tx_dropped":0,"tx_overruns":0,"tx_carrier":0,"tx_collisions":0,"rx_bytes":5602,"tx_bytes":13935,"ipv4":[{"address":"192.168.248.129","broadcast":"192.168.248.255","mask":"255.255.255.0"}],"ipv6":[{"address":"fe80::c1ca:3dee:39f7:5937","mask":64,"scope":"Link"}]},{"name":"lo","flags":null,"state":["UP LOOPBACK RUNNING "],"mtu":65536,"type":"Local Loopback","mac_addr":null,"ipv4_addr":"127.0.0.1","ipv4_mask":"255.0.0.0","ipv4_bcast":null,"ipv6_addr":"::1","ipv6_mask":128,"ipv6_scope":"Host","ipv6_type":null,"metric":1,"rx_packets":208,"rx_errors":0,"rx_dropped":0,"rx_overruns":0,"rx_frame":0,"tx_packets":208,"tx_errors":0,"tx_dropped":0,"tx_overruns":0,"tx_carrier":0,"tx_collisions":0,"rx_bytes":17363,"tx_bytes":17363,"ipv4":[{"address":"127.0.0.1","broadcast":null,"mask":"255.0.0.0"}],"ipv6":[{"address":"::1","mask":128,"scope":"Host"}]}]
|
17
tests/fixtures/ubuntu-16.04/ifconfig.out
vendored
Normal file
17
tests/fixtures/ubuntu-16.04/ifconfig.out
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
ens33 Link encap:Ethernet HWaddr 00:0c:29:c2:c8:63
|
||||||
|
inet addr:192.168.248.129 Bcast:192.168.248.255 Mask:255.255.255.0
|
||||||
|
inet6 addr: fe80::c1ca:3dee:39f7:5937/64 Scope:Link
|
||||||
|
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
|
||||||
|
RX packets:36 errors:0 dropped:0 overruns:0 frame:0
|
||||||
|
TX packets:152 errors:0 dropped:0 overruns:0 carrier:0
|
||||||
|
collisions:0 txqueuelen:1000
|
||||||
|
RX bytes:5602 (5.6 KB) TX bytes:13935 (13.9 KB)
|
||||||
|
|
||||||
|
lo Link encap:Local Loopback
|
||||||
|
inet addr:127.0.0.1 Mask:255.0.0.0
|
||||||
|
inet6 addr: ::1/128 Scope:Host
|
||||||
|
UP LOOPBACK RUNNING MTU:65536 Metric:1
|
||||||
|
RX packets:208 errors:0 dropped:0 overruns:0 frame:0
|
||||||
|
TX packets:208 errors:0 dropped:0 overruns:0 carrier:0
|
||||||
|
collisions:0 txqueuelen:1000
|
||||||
|
RX bytes:17363 (17.3 KB) TX bytes:17363 (17.3 KB)
|
@ -12,6 +12,9 @@ class MyTests(unittest.TestCase):
|
|||||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/ifconfig.out'), 'r', encoding='utf-8') as f:
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/ifconfig.out'), 'r', encoding='utf-8') as f:
|
||||||
centos_7_7_ifconfig = f.read()
|
centos_7_7_ifconfig = f.read()
|
||||||
|
|
||||||
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-16.04/ifconfig.out'), 'r', encoding='utf-8') as f:
|
||||||
|
ubuntu_16_4_ifconfig = f.read()
|
||||||
|
|
||||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/ifconfig.out'), 'r', encoding='utf-8') as f:
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/ifconfig.out'), 'r', encoding='utf-8') as f:
|
||||||
ubuntu_18_4_ifconfig = f.read()
|
ubuntu_18_4_ifconfig = f.read()
|
||||||
|
|
||||||
@ -43,6 +46,9 @@ class MyTests(unittest.TestCase):
|
|||||||
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())
|
||||||
|
|
||||||
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-16.04/ifconfig.json'), 'r', encoding='utf-8') as f:
|
||||||
|
ubuntu_16_4_ifconfig_json = json.loads(f.read())
|
||||||
|
|
||||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/ifconfig.json'), 'r', encoding='utf-8') as f:
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/ifconfig.json'), 'r', encoding='utf-8') as f:
|
||||||
ubuntu_18_4_ifconfig_json = json.loads(f.read())
|
ubuntu_18_4_ifconfig_json = json.loads(f.read())
|
||||||
|
|
||||||
@ -82,6 +88,12 @@ class MyTests(unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
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_16_4(self):
|
||||||
|
"""
|
||||||
|
Test 'ifconfig' on Ubuntu 16.4
|
||||||
|
"""
|
||||||
|
self.assertEqual(jc.parsers.ifconfig.parse(self.ubuntu_16_4_ifconfig, quiet=True), self.ubuntu_16_4_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
|
||||||
|
Reference in New Issue
Block a user