diff --git a/tests/fixtures/freebsd12/last.json b/tests/fixtures/freebsd12/last.json new file mode 100644 index 00000000..b94a352c --- /dev/null +++ b/tests/fixtures/freebsd12/last.json @@ -0,0 +1 @@ +[{"user": "kbrazil", "tty": "pts/0", "hostname": "192.168.71.1", "login": "Thu May 28 21:29", "logout": "still logged in"}, {"user": "kbrazil", "tty": "pts/0", "hostname": "192.168.71.1", "login": "Thu May 28 04:13", "logout": "21:29", "duration": "17:16"}, {"user": "kbrazil", "tty": "pts/0", "hostname": "192.168.71.1", "login": "Wed May 27 16:09", "logout": "04:13", "duration": "12:03"}, {"user": "root", "tty": "ttyv0", "hostname": null, "login": "Wed May 27 12:48", "logout": "still logged in"}, {"user": "kbrazil", "tty": "pts/0", "hostname": "192.168.71.1", "login": "Wed May 27 12:47", "logout": "16:09", "duration": "03:22"}, {"user": "kbrazil", "tty": "ttyv0", "hostname": null, "login": "Wed May 27 12:46", "logout": "12:48", "duration": "00:01"}, {"user": "boot time", "tty": null, "hostname": null, "login": "Wed May 27 12:46"}] diff --git a/tests/fixtures/freebsd12/last.out b/tests/fixtures/freebsd12/last.out new file mode 100644 index 00000000..c0f2485e --- /dev/null +++ b/tests/fixtures/freebsd12/last.out @@ -0,0 +1,9 @@ +kbrazil pts/0 192.168.71.1 Thu May 28 21:29 still logged in +kbrazil pts/0 192.168.71.1 Thu May 28 04:13 - 21:29 (17:16) +kbrazil pts/0 192.168.71.1 Wed May 27 16:09 - 04:13 (12:03) +root ttyv0 Wed May 27 12:48 still logged in +kbrazil pts/0 192.168.71.1 Wed May 27 12:47 - 16:09 (03:22) +kbrazil ttyv0 Wed May 27 12:46 - 12:48 (00:01) +boot time Wed May 27 12:46 + +utx.log begins Wed May 27 12:46:05 PDT 2020 diff --git a/tests/test_last.py b/tests/test_last.py index 598eaed0..7f146786 100644 --- a/tests/test_last.py +++ b/tests/test_last.py @@ -34,6 +34,9 @@ class MyTests(unittest.TestCase): with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/fedora32/last.out'), 'r', encoding='utf-8') as f: self.fedora32_last = f.read() + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/last.out'), 'r', encoding='utf-8') as f: + self.freebsd12_last = f.read() + # output with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/last.json'), 'r', encoding='utf-8') as f: self.centos_7_7_last_json = json.loads(f.read()) @@ -59,6 +62,9 @@ class MyTests(unittest.TestCase): with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/fedora32/last.json'), 'r', encoding='utf-8') as f: self.fedora32_last_json = json.loads(f.read()) + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/last.json'), 'r', encoding='utf-8') as f: + self.freebsd12_last_json = json.loads(f.read()) + def test_last_centos_7_7(self): """ Test plain 'last' on Centos 7.7 @@ -107,6 +113,12 @@ class MyTests(unittest.TestCase): """ self.assertEqual(jc.parsers.last.parse(self.fedora32_last, quiet=True), self.fedora32_last_json) + def test_last_freebsd12(self): + """ + Test plain 'last' on FreeBSD12 + """ + self.assertEqual(jc.parsers.last.parse(self.freebsd12_last, quiet=True), self.freebsd12_last_json) + if __name__ == '__main__': unittest.main()