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

add osx uname tests

This commit is contained in:
Kelly Brazil
2019-12-16 11:12:45 -08:00
parent 9335cf65fb
commit 1e8b68153a
4 changed files with 27 additions and 1 deletions

View File

@ -0,0 +1 @@
{"machine": "x86_64", "kernel_name": "Darwin", "node_name": "Kellys-Air.attlocal.net", "kernel_release": "15.6.0", "kernel_version": "Darwin Kernel Version 15.6.0: Thu Jun 21 20:07:40 PDT 2018; root:xnu-3248.73.11~1/RELEASE_X86_64"}

View File

@ -0,0 +1 @@
{"machine": "x86_64", "kernel_name": "Darwin", "node_name": "kbrazil-mac", "kernel_release": "18.7.0", "kernel_version": "Darwin Kernel Version 18.7.0: Sun Dec 1 18:59:03 PST 2019; root:xnu-4903.278.19~1/RELEASE_X86_64"}

View File

@ -1 +1 @@
Darwin Kellys-MBP.attlocal.net 18.7.0 Darwin Kernel Version 18.7.0: Sat Oct 12 00:02:19 PDT 2019; root:xnu-4903.278.12~1/RELEASE_X86_64 x86_64
Darwin kbrazil-mac 18.7.0 Darwin Kernel Version 18.7.0: Sun Dec 1 18:59:03 PST 2019; root:xnu-4903.278.19~1/RELEASE_X86_64 x86_64

View File

@ -16,6 +16,12 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/uname-a.out'), 'r') as f:
self.ubuntu_18_4_uname_a = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/uname-a.out'), 'r') as f:
self.osx_10_11_6_uname_a = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/uname-a.out'), 'r') as f:
self.osx_10_14_6_uname_a = f.read()
# output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/uname-a.json'), 'r') as f:
self.centos_7_7_uname_a_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/uname-a.json'), 'r') as f:
self.ubuntu_18_4_uname_a_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/uname-a.json'), 'r') as f:
self.osx_10_11_6_uname_a_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/uname-a.json'), 'r') as f:
self.osx_10_14_6_uname_a_json = json.loads(f.read())
def test_uname_centos_7_7(self):
"""
Test 'uname -a' on Centos 7.7
@ -35,6 +47,18 @@ class MyTests(unittest.TestCase):
"""
self.assertEqual(jc.parsers.uname.parse(self.ubuntu_18_4_uname_a, quiet=True), self.ubuntu_18_4_uname_a_json)
def test_uname_osx_10_11_6(self):
"""
Test 'uname -a' on OSX 10.11.6
"""
self.assertEqual(jc.parsers.uname.parse(self.osx_10_11_6_uname_a, quiet=True), self.osx_10_11_6_uname_a_json)
def test_uname_osx_10_14_6(self):
"""
Test 'uname -a' on OSX 10.14.6
"""
self.assertEqual(jc.parsers.uname.parse(self.osx_10_14_6_uname_a, quiet=True), self.osx_10_14_6_uname_a_json)
if __name__ == '__main__':
unittest.main()