mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
add nixos test
This commit is contained in:
1
tests/fixtures/nixos/route-ee.json
vendored
Normal file
1
tests/fixtures/nixos/route-ee.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[{"destination": "default", "gateway": "_gateway", "genmask": "0.0.0.0", "flags": "UG", "metric": 202, "ref": 0, "use": 0, "iface": "ens33", "mss": 0, "window": 0, "irtt": 0, "flags_pretty": ["UP", "GATEWAY"]}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "flags": "U", "metric": 202, "ref": 0, "use": 0, "iface": "ens33", "mss": 0, "window": 0, "irtt": 0, "flags_pretty": ["UP"]}]
|
4
tests/fixtures/nixos/route-ee.out
vendored
Normal file
4
tests/fixtures/nixos/route-ee.out
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
Kernel IP routing table
|
||||
Destination Gateway Genmask Flags Metric Ref Use Iface MSS Window irtt
|
||||
default _gateway 0.0.0.0 UG 202 0 0 ens33 0 0 0
|
||||
192.168.71.0 0.0.0.0 255.255.255.0 U 202 0 0 ens33 0 0 0
|
@ -22,6 +22,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/route-vn.out'), 'r', encoding='utf-8') as f:
|
||||
self.ubuntu_18_4_route_vn = f.read()
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/nixos/route-ee.out'), 'r', encoding='utf-8') as f:
|
||||
self.nixos_route_ee = f.read()
|
||||
|
||||
# output
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/route.json'), 'r', encoding='utf-8') as f:
|
||||
self.centos_7_7_route_json = json.loads(f.read())
|
||||
@ -35,6 +38,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/route-vn.json'), 'r', encoding='utf-8') as f:
|
||||
self.ubuntu_18_4_route_vn_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/nixos/route-ee.json'), 'r', encoding='utf-8') as f:
|
||||
self.nixos_route_ee_json = json.loads(f.read())
|
||||
|
||||
def test_route_centos_7_7(self):
|
||||
"""
|
||||
Test 'route' on Centos 7.7
|
||||
@ -59,6 +65,12 @@ class MyTests(unittest.TestCase):
|
||||
"""
|
||||
self.assertEqual(jc.parsers.route.parse(self.ubuntu_18_4_route_vn, quiet=True), self.ubuntu_18_4_route_vn_json)
|
||||
|
||||
def test_route_ee_nixos(self):
|
||||
"""
|
||||
Test 'route -ee' on NixOS
|
||||
"""
|
||||
self.assertEqual(jc.parsers.route.parse(self.nixos_route_ee, quiet=True), self.nixos_route_ee_json)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Reference in New Issue
Block a user