mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-13 01:20:24 +02:00
add osx tests
This commit is contained in:
1
tests/fixtures/osx-10.11.6/ps-axu.json
vendored
Normal file
1
tests/fixtures/osx-10.11.6/ps-axu.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
tests/fixtures/osx-10.11.6/ps-ef.json
vendored
Normal file
1
tests/fixtures/osx-10.11.6/ps-ef.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1
tests/fixtures/osx-10.11.6/w.json
vendored
Normal file
1
tests/fixtures/osx-10.11.6/w.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[{"user": "kelly", "tty": "console", "from": null, "login_at": "02Dec19", "idle": "10days", "what": null}, {"user": "kelly", "tty": "s000", "from": null, "login_at": "Thu11", "idle": null, "what": "ssh localhost"}, {"user": "kelly", "tty": "s001", "from": "::1", "login_at": "10:02", "idle": null, "what": "-bash"}, {"user": "kelly", "tty": "s002", "from": null, "login_at": "10:02", "idle": null, "what": "w"}, {"user": "kelly", "tty": "s003", "from": null, "login_at": "10:03", "idle": null, "what": "ssh 127.0.0.1"}, {"user": "kelly", "tty": "s004", "from": "127.0.0.1", "login_at": "10:03", "idle": null, "what": "-bash"}]
|
1
tests/fixtures/osx-10.14.6/w.json
vendored
Normal file
1
tests/fixtures/osx-10.14.6/w.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[{"user": "kelly", "tty": "console", "from": null, "login_at": "22Nov19", "idle": "20days", "what": null}, {"user": "kelly", "tty": "s000", "from": null, "login_at": "Wed16", "idle": null, "what": "ssh localhost"}, {"user": "kelly", "tty": "s001", "from": "127.0.0.1", "login_at": "10:14", "idle": null, "what": "-bash"}, {"user": "kelly", "tty": "s002", "from": null, "login_at": "10:14", "idle": null, "what": "ssh 127.0.0.1"}, {"user": "kelly", "tty": "s003", "from": "127.0.0.1", "login_at": "10:14", "idle": null, "what": "-bash"}, {"user": "kelly", "tty": "s004", "from": null, "login_at": "10:14", "idle": null, "what": "ssh ::1"}, {"user": "kelly", "tty": "s005", "from": "::1", "login_at": "10:15", "idle": null, "what": "-bash"}, {"user": "kelly", "tty": "s006", "from": null, "login_at": "10:15", "idle": null, "what": "w"}]
|
@ -16,6 +16,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/ps-ef.out'), 'r') as f:
|
||||
self.ubuntu_18_4_ps_ef = f.read()
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/ps-ef.out'), 'r') as f:
|
||||
self.osx_10_11_6_ps_ef = f.read()
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/ps-ef.out'), 'r') as f:
|
||||
self.osx_10_14_6_ps_ef = f.read()
|
||||
|
||||
@ -25,6 +28,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/ps-axu.out'), 'r') as f:
|
||||
self.ubuntu_18_4_ps_axu = f.read()
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/ps-axu.out'), 'r') as f:
|
||||
self.osx_10_11_6_ps_axu = f.read()
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/ps-axu.out'), 'r') as f:
|
||||
self.osx_10_14_6_ps_axu = f.read()
|
||||
|
||||
@ -35,6 +41,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/ps-ef.json'), 'r') as f:
|
||||
self.ubuntu_18_4_ps_ef_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/ps-ef.json'), 'r') as f:
|
||||
self.osx_10_11_6_ps_ef_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/ps-ef.json'), 'r') as f:
|
||||
self.osx_10_14_6_ps_ef_json = json.loads(f.read())
|
||||
|
||||
@ -44,6 +53,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/ps-axu.json'), 'r') as f:
|
||||
self.ubuntu_18_4_ps_axu_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/ps-axu.json'), 'r') as f:
|
||||
self.osx_10_11_6_ps_axu_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/ps-axu.json'), 'r') as f:
|
||||
self.osx_10_14_6_ps_axu_json = json.loads(f.read())
|
||||
|
||||
@ -59,6 +71,12 @@ class MyTests(unittest.TestCase):
|
||||
"""
|
||||
self.assertEqual(jc.parsers.ps.parse(self.ubuntu_18_4_ps_ef, quiet=True), self.ubuntu_18_4_ps_ef_json)
|
||||
|
||||
def test_ps_ef_osx_10_11_6(self):
|
||||
"""
|
||||
Test 'ps -ef' on OSX 10.11.6
|
||||
"""
|
||||
self.assertEqual(jc.parsers.ps.parse(self.osx_10_11_6_ps_ef, quiet=True), self.osx_10_11_6_ps_ef_json)
|
||||
|
||||
def test_ps_ef_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ps -ef' on OSX 10.14.6
|
||||
@ -77,6 +95,12 @@ class MyTests(unittest.TestCase):
|
||||
"""
|
||||
self.assertEqual(jc.parsers.ps.parse(self.ubuntu_18_4_ps_axu, quiet=True), self.ubuntu_18_4_ps_axu_json)
|
||||
|
||||
def test_ps_axu_osx_10_11_6(self):
|
||||
"""
|
||||
Test 'ps axu' on OSX 10.11.6
|
||||
"""
|
||||
self.assertEqual(jc.parsers.ps.parse(self.osx_10_11_6_ps_axu, quiet=True), self.osx_10_11_6_ps_axu_json)
|
||||
|
||||
def test_ps_axu_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ps axu' on OSX 10.14.6
|
||||
|
@ -16,6 +16,12 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/w.out'), 'r') as f:
|
||||
self.ubuntu_18_4_w = f.read()
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/w.out'), 'r') as f:
|
||||
self.osx_10_11_6_w = f.read()
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/w.out'), 'r') as f:
|
||||
self.osx_10_14_6_w = f.read()
|
||||
|
||||
# output
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/w.json'), 'r') as f:
|
||||
self.centos_7_7_w_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/w.json'), 'r') as f:
|
||||
self.ubuntu_18_4_w_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/w.json'), 'r') as f:
|
||||
self.osx_10_11_6_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/w.json'), 'r') as f:
|
||||
self.osx_10_14_6_json = json.loads(f.read())
|
||||
|
||||
def test_w_centos_7_7(self):
|
||||
"""
|
||||
Test 'w' on Centos 7.7
|
||||
@ -35,6 +47,18 @@ class MyTests(unittest.TestCase):
|
||||
"""
|
||||
self.assertEqual(jc.parsers.w.parse(self.ubuntu_18_4_w, quiet=True), self.ubuntu_18_4_w_json)
|
||||
|
||||
def test_w_osx_10_11_6(self):
|
||||
"""
|
||||
Test 'w' on OSX 10.11.6
|
||||
"""
|
||||
self.assertEqual(jc.parsers.w.parse(self.osx_10_11_6_w, quiet=True), self.osx_10_11_6_json)
|
||||
|
||||
def test_w_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'w' on OSX 10.14.6
|
||||
"""
|
||||
self.assertEqual(jc.parsers.w.parse(self.osx_10_14_6_w, quiet=True), self.osx_10_14_6_json)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Reference in New Issue
Block a user