mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
add OSX finger tests
This commit is contained in:
1
tests/fixtures/osx-10.14.6/finger.json
vendored
Normal file
1
tests/fixtures/osx-10.14.6/finger.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[{"login":"kbrazil","name":"kbrazil","tty":"con","idle":"15d","login_time":"Mar 22 07:33","tty_writeable":false,"idle_minutes":0,"idle_hours":0,"idle_days":15,"total_idle_minutes":21600},{"login":"kbrazil","name":"kbrazil","tty":"s00","idle":null,"login_time":"Mar 22 07:34","tty_writeable":true,"idle_minutes":0,"idle_hours":0,"idle_days":0,"total_idle_minutes":0},{"login":"kbrazil","name":"kbrazil","tty":"s00","idle":"8","tty_writeable":true,"idle_minutes":8,"idle_hours":0,"idle_days":0,"total_idle_minutes":8},{"login":"kbrazil","name":"kbrazil","tty":"s00","idle":"1:19","login_time":"Mar 22 07:34","tty_writeable":true,"idle_minutes":19,"idle_hours":1,"idle_days":0,"total_idle_minutes":79}]
|
5
tests/fixtures/osx-10.14.6/finger.out
vendored
Normal file
5
tests/fixtures/osx-10.14.6/finger.out
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
Login Name TTY Idle Login Time Office Phone
|
||||
kbrazil kbrazil *con 15d Mar 22 07:33
|
||||
kbrazil kbrazil s00 Mar 22 07:34
|
||||
kbrazil kbrazil s00 8 Tue 09:04
|
||||
kbrazil kbrazil s00 1:19 Mar 22 07:34
|
@ -16,6 +16,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/finger.out'), 'r', encoding='utf-8') as f:
|
||||
self.ubuntu_18_4_finger = f.read()
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/finger.out'), 'r', encoding='utf-8') as f:
|
||||
self.osx_10_14_6_finger = f.read()
|
||||
|
||||
# output
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/finger.json'), 'r', encoding='utf-8') as f:
|
||||
self.centos_7_7_finger_json = json.loads(f.read())
|
||||
@ -23,6 +26,9 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/finger.json'), 'r', encoding='utf-8') as f:
|
||||
self.ubuntu_18_4_finger_json = json.loads(f.read())
|
||||
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/finger.json'), 'r', encoding='utf-8') as f:
|
||||
self.osx_10_14_6_finger_json = json.loads(f.read())
|
||||
|
||||
|
||||
def test_finger_nodata(self):
|
||||
"""
|
||||
@ -42,6 +48,12 @@ class MyTests(unittest.TestCase):
|
||||
"""
|
||||
self.assertEqual(jc.parsers.finger.parse(self.ubuntu_18_4_finger, quiet=True), self.ubuntu_18_4_finger_json)
|
||||
|
||||
def test_finger_osx_10_14_6(self):
|
||||
"""
|
||||
Test plain 'finger' on OSX 10.14.6
|
||||
"""
|
||||
self.assertEqual(jc.parsers.finger.parse(self.osx_10_14_6_finger, quiet=True), self.osx_10_14_6_finger_json)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Reference in New Issue
Block a user