mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-08-10 22:41:51 +02:00
add osx tests
This commit is contained in:
1
tests/fixtures/osx-10.11.6/uptime.json
vendored
Normal file
1
tests/fixtures/osx-10.11.6/uptime.json
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"time": "10:09", "uptime": "3 mins", "users": 3, "load_1m": 5.63, "load_5m": 7.26, "load_15m": 3.53}
|
1
tests/fixtures/osx-10.14.6/uptime.json
vendored
Normal file
1
tests/fixtures/osx-10.14.6/uptime.json
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"time": "10:15", "uptime": "20 days, 19:45", "users": 8, "load_1m": 1.63, "load_5m": 0.65, "load_15m": 0.44}
|
@@ -16,6 +16,12 @@ class MyTests(unittest.TestCase):
|
|||||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/uptime.out'), 'r') as f:
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/uptime.out'), 'r') as f:
|
||||||
self.ubuntu_18_4_uptime = f.read()
|
self.ubuntu_18_4_uptime = f.read()
|
||||||
|
|
||||||
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/uptime.out'), 'r') as f:
|
||||||
|
self.osx_10_11_6_uptime = f.read()
|
||||||
|
|
||||||
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/uptime.out'), 'r') as f:
|
||||||
|
self.osx_10_14_6_uptime = f.read()
|
||||||
|
|
||||||
# output
|
# output
|
||||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/uptime.json'), 'r') as f:
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/uptime.json'), 'r') as f:
|
||||||
self.centos_7_7_uptime_json = json.loads(f.read())
|
self.centos_7_7_uptime_json = json.loads(f.read())
|
||||||
@@ -23,6 +29,12 @@ class MyTests(unittest.TestCase):
|
|||||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/uptime.json'), 'r') as f:
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/uptime.json'), 'r') as f:
|
||||||
self.ubuntu_18_4_uptime_json = json.loads(f.read())
|
self.ubuntu_18_4_uptime_json = json.loads(f.read())
|
||||||
|
|
||||||
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/uptime.json'), 'r') as f:
|
||||||
|
self.osx_10_11_6_uptime_json = json.loads(f.read())
|
||||||
|
|
||||||
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/uptime.json'), 'r') as f:
|
||||||
|
self.osx_10_14_6_uptime_json = json.loads(f.read())
|
||||||
|
|
||||||
def test_uptime_centos_7_7(self):
|
def test_uptime_centos_7_7(self):
|
||||||
"""
|
"""
|
||||||
Test 'uptime' on Centos 7.7
|
Test 'uptime' on Centos 7.7
|
||||||
@@ -35,6 +47,18 @@ class MyTests(unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
self.assertEqual(jc.parsers.uptime.parse(self.ubuntu_18_4_uptime, quiet=True), self.ubuntu_18_4_uptime_json)
|
self.assertEqual(jc.parsers.uptime.parse(self.ubuntu_18_4_uptime, quiet=True), self.ubuntu_18_4_uptime_json)
|
||||||
|
|
||||||
|
def test_uptime_osx_10_11_6(self):
|
||||||
|
"""
|
||||||
|
Test 'uptime' on OSX 10.11.6
|
||||||
|
"""
|
||||||
|
self.assertEqual(jc.parsers.uptime.parse(self.osx_10_11_6_uptime, quiet=True), self.osx_10_11_6_uptime_json)
|
||||||
|
|
||||||
|
def test_uptime_osx_10_14_6(self):
|
||||||
|
"""
|
||||||
|
Test 'uptime' on OSX 10.14.6
|
||||||
|
"""
|
||||||
|
self.assertEqual(jc.parsers.uptime.parse(self.osx_10_14_6_uptime, quiet=True), self.osx_10_14_6_uptime_json)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Reference in New Issue
Block a user