mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
change streaming parser test names
This commit is contained in:
@ -99,13 +99,13 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/ls-l-iso-streaming.json'), 'r', encoding='utf-8') as f:
|
||||
self.ubuntu_18_4_ls_l_iso_streaming_json = json.loads(f.read())
|
||||
|
||||
def test_ls_empty_dir(self):
|
||||
def test_ls_s_empty_dir(self):
|
||||
"""
|
||||
Test plain 'ls' on an empty directory
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ls_s.parse('', quiet=True)), [])
|
||||
|
||||
def test_ls_centos_7_7(self):
|
||||
def test_ls_s_centos_7_7_raise_exception(self):
|
||||
"""
|
||||
Test plain 'ls /' on Centos 7.7 (raises ParseError)
|
||||
"""
|
||||
@ -113,67 +113,67 @@ class MyTests(unittest.TestCase):
|
||||
with self.assertRaises(ParseError):
|
||||
list(g)
|
||||
|
||||
def test_ls_al_centos_7_7(self):
|
||||
def test_ls_s_al_centos_7_7(self):
|
||||
"""
|
||||
Test 'ls -al /' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ls_s.parse(self.centos_7_7_ls_al.splitlines(), quiet=True)), self.centos_7_7_ls_al_streaming_json)
|
||||
|
||||
def test_ls_al_ubuntu_18_4(self):
|
||||
def test_ls_s_al_ubuntu_18_4(self):
|
||||
"""
|
||||
Test 'ls -al /' on Ubuntu 18.4
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ls_s.parse(self.ubuntu_18_4_ls_al.splitlines(), quiet=True)), self.ubuntu_18_4_ls_al_streaming_json)
|
||||
|
||||
def test_ls_al_osx_10_14_6(self):
|
||||
def test_ls_s_al_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ls -al /' on OSX 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ls_s.parse(self.osx_10_14_6_ls_al.splitlines(), quiet=True)), self.osx_10_14_6_ls_al_streaming_json)
|
||||
|
||||
def test_ls_alh_centos_7_7(self):
|
||||
def test_ls_s_alh_centos_7_7(self):
|
||||
"""
|
||||
Test 'ls -alh /' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ls_s.parse(self.centos_7_7_ls_alh.splitlines(), quiet=True)), self.centos_7_7_ls_alh_streaming_json)
|
||||
|
||||
def test_ls_alh_ubuntu_18_4(self):
|
||||
def test_ls_s_alh_ubuntu_18_4(self):
|
||||
"""
|
||||
Test 'ls -alh /' on Ubuntu 18.4
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ls_s.parse(self.ubuntu_18_4_ls_alh.splitlines(), quiet=True)), self.ubuntu_18_4_ls_alh_streaming_json)
|
||||
|
||||
def test_ls_alh_osx_10_14_6(self):
|
||||
def test_ls_s_alh_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ls -alh /' on OSX 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ls_s.parse(self.osx_10_14_6_ls_alh.splitlines(), quiet=True)), self.osx_10_14_6_ls_alh_streaming_json)
|
||||
|
||||
def test_ls_alR_centos_7_7(self):
|
||||
def test_ls_s_alR_centos_7_7(self):
|
||||
"""
|
||||
Test 'ls -alR /usr' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ls_s.parse(self.centos_7_7_ls_alR.splitlines(), quiet=True)), self.centos_7_7_ls_alR_streaming_json)
|
||||
|
||||
def test_ls_alR_ubuntu_18_4(self):
|
||||
def test_ls_s_alR_ubuntu_18_4(self):
|
||||
"""
|
||||
Test 'ls -alR /usr' on Ubuntu 18.4
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ls_s.parse(self.ubuntu_18_4_ls_alR.splitlines(), quiet=True)), self.ubuntu_18_4_ls_alR_streaming_json)
|
||||
|
||||
def test_ls_alR_osx_10_14_6(self):
|
||||
def test_ls_s_alR_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ls -alR /usr' on OSX 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ls_s.parse(self.osx_10_14_6_ls_alR.splitlines(), quiet=True)), self.osx_10_14_6_ls_alR_streaming_json)
|
||||
|
||||
def test_ls_lR_empty_folder_osx_10_14_6(self):
|
||||
def test_ls_s_lR_empty_folder_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ls -lR' for empty directories on OSX 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ls_s.parse(self.osx_10_14_6_ls_lR_empty_folder.splitlines(), quiet=True)), self.osx_10_14_6_ls_lR_empty_folder_streaming_json)
|
||||
|
||||
def test_ls_l_iso_ubuntu_18_4(self):
|
||||
def test_ls_s_l_iso_ubuntu_18_4(self):
|
||||
"""
|
||||
Test 'ls -l --time-style=full-iso' for files with convertible dates on Ubuntu 18.4
|
||||
"""
|
||||
|
@ -393,19 +393,25 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/pi/ping-ip-O-D-streaming.json'), 'r', encoding='utf-8') as f:
|
||||
self.pi_ping_ip_O_D_streaming_json = json.loads(f.read())
|
||||
|
||||
def test_ping_nodata(self):
|
||||
def test_ping_s_nodata(self):
|
||||
"""
|
||||
Test 'ping' with no data
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse('')), [])
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse('', quiet=True)), [])
|
||||
|
||||
def test_ping_ignore_exceptions_success(self):
|
||||
def test_ping_s_unparsable(self):
|
||||
data = 'unparsable data'
|
||||
g = jc.parsers.ping_s.parse(data.splitlines(), quiet=True)
|
||||
with self.assertRaises(ParseError):
|
||||
list(g)
|
||||
|
||||
def test_ping_s_ignore_exceptions_success(self):
|
||||
"""
|
||||
Test 'ping' with -qq (ignore_exceptions) option
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.centos_7_7_ping_ip_O.splitlines(), quiet=True, ignore_exceptions=True)), self.centos_7_7_ping_ip_O_streaming_ignore_exceptions_json)
|
||||
|
||||
def test_ping_ignore_exceptions_error(self):
|
||||
def test_ping_s_ignore_exceptions_error(self):
|
||||
"""
|
||||
Test 'ping' with -qq (ignore_exceptions) option option and error
|
||||
"""
|
||||
@ -413,43 +419,43 @@ class MyTests(unittest.TestCase):
|
||||
expected = json.loads('[{"_jc_meta":{"success":false,"error":"ParseError: Could not detect ping OS","line":"not ping"}}]')
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(data_in.splitlines(), quiet=True, ignore_exceptions=True)), expected)
|
||||
|
||||
def test_ping_ip_O_centos_7_7(self):
|
||||
def test_ping_s_ip_O_centos_7_7(self):
|
||||
"""
|
||||
Test 'ping <ip> -O' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.centos_7_7_ping_ip_O.splitlines(), quiet=True)), self.centos_7_7_ping_ip_O_streaming_json)
|
||||
|
||||
def test_ping_ip_O_D_centos_7_7(self):
|
||||
def test_ping_s_ip_O_D_centos_7_7(self):
|
||||
"""
|
||||
Test 'ping <ip> -O -D' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.centos_7_7_ping_ip_O_D.splitlines(), quiet=True)), self.centos_7_7_ping_ip_O_D_streaming_json)
|
||||
|
||||
def test_ping_hostname_O_centos_7_7(self):
|
||||
def test_ping_s_hostname_O_centos_7_7(self):
|
||||
"""
|
||||
Test 'ping <hostname> -O' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.centos_7_7_ping_hostname_O.splitlines(), quiet=True)), self.centos_7_7_ping_hostname_O_streaming_json)
|
||||
|
||||
def test_ping_hostname_O_p_centos_7_7(self):
|
||||
def test_ping_s_hostname_O_p_centos_7_7(self):
|
||||
"""
|
||||
Test 'ping <hostname> -O -p' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.centos_7_7_ping_hostname_O_p.splitlines(), quiet=True)), self.centos_7_7_ping_hostname_O_p_streaming_json)
|
||||
|
||||
def test_ping_hostname_O_D_p_s_centos_7_7(self):
|
||||
def test_ping_s_hostname_O_D_p_s_centos_7_7(self):
|
||||
"""
|
||||
Test 'ping <hostname> -O -D -p -s' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.centos_7_7_ping_hostname_O_D_p_s.splitlines(), quiet=True)), self.centos_7_7_ping_hostname_O_D_p_s_streaming_json)
|
||||
|
||||
def test_ping6_ip_O_p_centos_7_7(self):
|
||||
def test_ping6_s_ip_O_p_centos_7_7(self):
|
||||
"""
|
||||
Test 'ping6 <ip> -O -p' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.centos_7_7_ping6_ip_O_p.splitlines(), quiet=True)), self.centos_7_7_ping6_ip_O_p_streaming_json)
|
||||
|
||||
def test_ping6_ip_O_p_unparsable_centos_7_7(self):
|
||||
def test_ping6_s_ip_O_p_unparsable_centos_7_7(self):
|
||||
"""
|
||||
Test 'ping6 <ip> -O -p' with unparsable lines on Centos 7.7 (raises IndexError)
|
||||
"""
|
||||
@ -457,37 +463,37 @@ class MyTests(unittest.TestCase):
|
||||
with self.assertRaises(IndexError):
|
||||
list(g)
|
||||
|
||||
def test_ping6_ip_O_D_p_centos_7_7(self):
|
||||
def test_ping6_s_ip_O_D_p_centos_7_7(self):
|
||||
"""
|
||||
Test 'ping6 <ip> -O -D -p' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.centos_7_7_ping6_ip_O_D_p.splitlines(), quiet=True)), self.centos_7_7_ping6_ip_O_D_p_streaming_json)
|
||||
|
||||
def test_ping6_hostname_O_p_centos_7_7(self):
|
||||
def test_ping6_s_hostname_O_p_centos_7_7(self):
|
||||
"""
|
||||
Test 'ping6 <hostname> -O -p' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.centos_7_7_ping6_hostname_O_p.splitlines(), quiet=True)), self.centos_7_7_ping6_hostname_O_p_streaming_json)
|
||||
|
||||
def test_ping6_hostname_O_D_p_s_centos_7_7(self):
|
||||
def test_ping6_s_hostname_O_D_p_s_centos_7_7(self):
|
||||
"""
|
||||
Test 'ping6 <hostname> -O -D -p -s' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.centos_7_7_ping6_hostname_O_D_p_s.splitlines(), quiet=True)), self.centos_7_7_ping6_hostname_O_D_p_s_streaming_json)
|
||||
|
||||
def test_ping_ip_dup_centos_7_7(self):
|
||||
def test_ping_s_ip_dup_centos_7_7(self):
|
||||
"""
|
||||
Test 'ping <ip>' to broadcast IP to get duplicate replies on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.centos_7_7_ping_ip_dup.splitlines(), quiet=True)), self.centos_7_7_ping_ip_dup_streaming_json)
|
||||
|
||||
def test_ping6_ip_dup_centos_7_7(self):
|
||||
def test_ping6_s_ip_dup_centos_7_7(self):
|
||||
"""
|
||||
Test 'ping6 <ip>' to broadcast IP to get duplicate replies on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.centos_7_7_ping6_ip_dup.splitlines(), quiet=True)), self.centos_7_7_ping6_ip_dup_streaming_json)
|
||||
|
||||
def test_ping_ip_O_unparsedlines_centos_7_7(self):
|
||||
def test_ping_s_ip_O_unparsedlines_centos_7_7(self):
|
||||
"""
|
||||
Test 'ping <ip> -O' on Centos 7.7 with unparsable lines and error messages
|
||||
"""
|
||||
@ -495,229 +501,229 @@ class MyTests(unittest.TestCase):
|
||||
with self.assertRaises(IndexError):
|
||||
list(g)
|
||||
|
||||
def test_ping_ip_O_ubuntu_18_4(self):
|
||||
def test_ping_s_ip_O_ubuntu_18_4(self):
|
||||
"""
|
||||
Test 'ping <ip> -O' on Ubuntu 18.4
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.ubuntu_18_4_ping_ip_O.splitlines(), quiet=True)), self.ubuntu_18_4_ping_ip_O_streaming_json)
|
||||
|
||||
def test_ping_ip_O_D_ubuntu_18_4(self):
|
||||
def test_ping_s_ip_O_D_ubuntu_18_4(self):
|
||||
"""
|
||||
Test 'ping <ip> -O -D' on Ubuntu 18.4
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.ubuntu_18_4_ping_ip_O_D.splitlines(), quiet=True)), self.ubuntu_18_4_ping_ip_O_D_streaming_json)
|
||||
|
||||
def test_ping_hostname_O_ubuntu_18_4(self):
|
||||
def test_ping_s_hostname_O_ubuntu_18_4(self):
|
||||
"""
|
||||
Test 'ping <hostname> -O' on Ubuntu 18.4
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.ubuntu_18_4_ping_hostname_O.splitlines(), quiet=True)), self.ubuntu_18_4_ping_hostname_O_streaming_json)
|
||||
|
||||
def test_ping_hostname_O_p_ubuntu_18_4(self):
|
||||
def test_ping_s_hostname_O_p_ubuntu_18_4(self):
|
||||
"""
|
||||
Test 'ping <hostname> -O -p' on Ubuntu 18.4
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.ubuntu_18_4_ping_hostname_O_p.splitlines(), quiet=True)), self.ubuntu_18_4_ping_hostname_O_p_streaming_json)
|
||||
|
||||
def test_ping_hostname_O_D_p_s_ubuntu_18_4(self):
|
||||
def test_ping_s_hostname_O_D_p_s_ubuntu_18_4(self):
|
||||
"""
|
||||
Test 'ping <hostname> -O -D -p -s' on Ubuntu 18.4
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.ubuntu_18_4_ping_hostname_O_D_p_s.splitlines(), quiet=True)), self.ubuntu_18_4_ping_hostname_O_D_p_s_streaming_json)
|
||||
|
||||
def test_ping6_ip_O_p_ubuntu_18_4(self):
|
||||
def test_ping6_s_ip_O_p_ubuntu_18_4(self):
|
||||
"""
|
||||
Test 'ping6 <ip> -O -p' on Ubuntu 18.4
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.ubuntu_18_4_ping6_ip_O_p.splitlines(), quiet=True)), self.ubuntu_18_4_ping6_ip_O_p_streaming_json)
|
||||
|
||||
def test_ping6_ip_O_D_p_ubuntu_18_4(self):
|
||||
def test_ping6_s_ip_O_D_p_ubuntu_18_4(self):
|
||||
"""
|
||||
Test 'ping6 <ip> -O -D -p' on Ubuntu 18.4
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.ubuntu_18_4_ping6_ip_O_D_p.splitlines(), quiet=True)), self.ubuntu_18_4_ping6_ip_O_D_p_streaming_json)
|
||||
|
||||
def test_ping6_hostname_O_p_ubuntu_18_4(self):
|
||||
def test_ping6_s_hostname_O_p_ubuntu_18_4(self):
|
||||
"""
|
||||
Test 'ping6 <hostname> -O -p' on Ubuntu 18.4
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.ubuntu_18_4_ping6_hostname_O_p.splitlines(), quiet=True)), self.ubuntu_18_4_ping6_hostname_O_p_streaming_json)
|
||||
|
||||
def test_ping6_hostname_O_D_p_s_ubuntu_18_4(self):
|
||||
def test_ping6_s_hostname_O_D_p_s_ubuntu_18_4(self):
|
||||
"""
|
||||
Test 'ping6 <hostname> -O -D -p -s' on Ubuntu 18.4
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.ubuntu_18_4_ping6_hostname_O_D_p_s.splitlines(), quiet=True)), self.ubuntu_18_4_ping6_hostname_O_D_p_s_streaming_json)
|
||||
|
||||
def test_ping_ip_O_fedora32(self):
|
||||
def test_ping_s_ip_O_fedora32(self):
|
||||
"""
|
||||
Test 'ping <ip> -O' on fedora32
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.fedora32_ping_ip_O.splitlines(), quiet=True)), self.fedora32_ping_ip_O_streaming_json)
|
||||
|
||||
def test_ping_ip_O_D_fedora32(self):
|
||||
def test_ping_s_ip_O_D_fedora32(self):
|
||||
"""
|
||||
Test 'ping <ip> -O -D' on fedora32
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.fedora32_ping_ip_O_D.splitlines(), quiet=True)), self.fedora32_ping_ip_O_D_streaming_json)
|
||||
|
||||
def test_ping_hostname_O_fedora32(self):
|
||||
def test_ping_s_hostname_O_fedora32(self):
|
||||
"""
|
||||
Test 'ping <hostname> -O' on fedora32
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.fedora32_ping_hostname_O.splitlines(), quiet=True)), self.fedora32_ping_hostname_O_streaming_json)
|
||||
|
||||
def test_ping_hostname_O_p_fedora32(self):
|
||||
def test_ping_s_hostname_O_p_fedora32(self):
|
||||
"""
|
||||
Test 'ping <hostname> -O -p' on fedora32
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.fedora32_ping_hostname_O_p.splitlines(), quiet=True)), self.fedora32_ping_hostname_O_p_streaming_json)
|
||||
|
||||
def test_ping_hostname_O_D_p_s_fedora32(self):
|
||||
def test_ping_s_hostname_O_D_p_s_fedora32(self):
|
||||
"""
|
||||
Test 'ping <hostname> -O -D -p -s' on fedora32
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.fedora32_ping_hostname_O_D_p_s.splitlines(), quiet=True)), self.fedora32_ping_hostname_O_D_p_s_streaming_json)
|
||||
|
||||
def test_ping6_ip_O_p_fedora32(self):
|
||||
def test_ping6_s_ip_O_p_fedora32(self):
|
||||
"""
|
||||
Test 'ping6 <ip> -O -p' on fedora32
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.fedora32_ping6_ip_O_p.splitlines(), quiet=True)), self.fedora32_ping6_ip_O_p_streaming_json)
|
||||
|
||||
def test_ping6_ip_O_D_p_fedora32(self):
|
||||
def test_ping6_s_ip_O_D_p_fedora32(self):
|
||||
"""
|
||||
Test 'ping6 <ip> -O -D -p' on fedora32
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.fedora32_ping6_ip_O_D_p.splitlines(), quiet=True)), self.fedora32_ping6_ip_O_D_p_streaming_json)
|
||||
|
||||
def test_ping6_hostname_O_p_fedora32(self):
|
||||
def test_ping6_s_hostname_O_p_fedora32(self):
|
||||
"""
|
||||
Test 'ping6 <hostname> -O -p' on fedora32
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.fedora32_ping6_hostname_O_p.splitlines(), quiet=True)), self.fedora32_ping6_hostname_O_p_streaming_json)
|
||||
|
||||
def test_ping6_hostname_O_D_p_s_fedora32(self):
|
||||
def test_ping6_s_hostname_O_D_p_s_fedora32(self):
|
||||
"""
|
||||
Test 'ping6 <hostname> -O -D -p -s' on fedora32
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.fedora32_ping6_hostname_O_D_p_s.splitlines(), quiet=True)), self.fedora32_ping6_hostname_O_D_p_s_streaming_json)
|
||||
|
||||
def test_ping_hostname_p_freebsd12(self):
|
||||
def test_ping_s_hostname_p_freebsd12(self):
|
||||
"""
|
||||
Test 'ping <hostname> -p' on freebsd12
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.freebsd12_ping_hostname_p.splitlines(), quiet=True)), self.freebsd12_ping_hostname_p_streaming_json)
|
||||
|
||||
def test_ping_hostname_s_freebsd12(self):
|
||||
def test_ping_s_hostname_s_freebsd12(self):
|
||||
"""
|
||||
Test 'ping <hostname> -s' on freebsd12
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.freebsd12_ping_hostname_s.splitlines(), quiet=True)), self.freebsd12_ping_hostname_s_streaming_json)
|
||||
|
||||
def test_ping_ping_hostname_freebsd12(self):
|
||||
def test_ping_s_ping_hostname_freebsd12(self):
|
||||
"""
|
||||
Test 'ping <hostname>' on freebsd12
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.freebsd12_ping_hostname.splitlines(), quiet=True)), self.freebsd12_ping_hostname_streaming_json)
|
||||
|
||||
def test_ping_ip_p_freebsd12(self):
|
||||
def test_ping_s_ip_p_freebsd12(self):
|
||||
"""
|
||||
Test 'ping <ip> -p' on freebsd12
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.freebsd12_ping_ip_p.splitlines(), quiet=True)), self.freebsd12_ping_ip_p_streaming_json)
|
||||
|
||||
def test_ping_ip_s_freebsd12(self):
|
||||
def test_ping_s_ip_s_freebsd12(self):
|
||||
"""
|
||||
Test 'ping <ip> -s' on freebsd12
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.freebsd12_ping_ip_s.splitlines(), quiet=True)), self.freebsd12_ping_ip_s_streaming_json)
|
||||
|
||||
def test_ping_ip_freebsd12(self):
|
||||
def test_ping_s_ip_freebsd12(self):
|
||||
"""
|
||||
Test 'ping6 <ip>' on freebsd127
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.freebsd12_ping_ip.splitlines(), quiet=True)), self.freebsd12_ping_ip_streaming_json)
|
||||
|
||||
def test_ping6_hostname_p_freebsd12(self):
|
||||
def test_ping6_s_hostname_p_freebsd12(self):
|
||||
"""
|
||||
Test 'ping6 <hostname> -p' on freebsd12
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.freebsd12_ping6_hostname_p.splitlines(), quiet=True)), self.freebsd12_ping6_hostname_p_streaming_json)
|
||||
|
||||
def test_ping6_hostname_s_freebsd12(self):
|
||||
def test_ping6_s_hostname_s_freebsd12(self):
|
||||
"""
|
||||
Test 'ping6 <hostname> -s' on freebsd12
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.freebsd12_ping6_hostname_s.splitlines(), quiet=True)), self.freebsd12_ping6_hostname_s_streaming_json)
|
||||
|
||||
def test_ping6_hostname_freebsd12(self):
|
||||
def test_ping6_s_hostname_freebsd12(self):
|
||||
"""
|
||||
Test 'ping6 <hostname>' on freebsd12
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.freebsd12_ping6_hostname.splitlines(), quiet=True)), self.freebsd12_ping6_hostname_streaming_json)
|
||||
|
||||
def test_ping6_ip_p_freebsd12(self):
|
||||
def test_ping6_s_ip_p_freebsd12(self):
|
||||
"""
|
||||
Test 'ping6 <ip> -p' on freebsd12
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.freebsd12_ping6_ip_p.splitlines(), quiet=True)), self.freebsd12_ping6_ip_p_streaming_json)
|
||||
|
||||
def test_ping6_ip_s_freebsd12(self):
|
||||
def test_ping6_s_ip_s_freebsd12(self):
|
||||
"""
|
||||
Test 'ping6 <ip> -s' on freebsd12
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.freebsd12_ping6_ip_s.splitlines(), quiet=True)), self.freebsd12_ping6_ip_s_streaming_json)
|
||||
|
||||
def test_ping6_ip_freebsd12(self):
|
||||
def test_ping6_s_ip_freebsd12(self):
|
||||
"""
|
||||
Test 'ping6 <ip>' on freebsd12
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.freebsd12_ping6_ip.splitlines(), quiet=True)), self.freebsd12_ping6_ip_streaming_json)
|
||||
|
||||
def test_ping_hostname_p_osx_10_14_6(self):
|
||||
def test_ping_s_hostname_p_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ping <hostname> -p' on osx 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.osx_10_14_6_ping_hostname_p.splitlines(), quiet=True)), self.osx_10_14_6_ping_hostname_p_streaming_json)
|
||||
|
||||
def test_ping_hostname_s_osx_10_14_6(self):
|
||||
def test_ping_s_hostname_s_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ping <hostname> -s' on osx 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.osx_10_14_6_ping_hostname_s.splitlines(), quiet=True)), self.osx_10_14_6_ping_hostname_s_streaming_json)
|
||||
|
||||
def test_ping_hostname_osx_10_14_6(self):
|
||||
def test_ping_s_hostname_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ping <hostname>' on osx 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.osx_10_14_6_ping_hostname.splitlines(), quiet=True)), self.osx_10_14_6_ping_hostname_streaming_json)
|
||||
|
||||
def test_ping_ip_p_osx_10_14_6(self):
|
||||
def test_ping_s_ip_p_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ping <ip> -p' on osx 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.osx_10_14_6_ping_ip_p.splitlines(), quiet=True)), self.osx_10_14_6_ping_ip_p_streaming_json)
|
||||
|
||||
def test_ping_ip_s_osx_10_14_6(self):
|
||||
def test_ping_s_ip_s_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ping <ip> -s' on osx 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.osx_10_14_6_ping_ip_s.splitlines(), quiet=True)), self.osx_10_14_6_ping_ip_s_streaming_json)
|
||||
|
||||
def test_ping_ip_osx_10_14_6(self):
|
||||
def test_ping_s_ip_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ping <ip>' on osx 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.osx_10_14_6_ping_ip.splitlines(), quiet=True)), self.osx_10_14_6_ping_ip_streaming_json)
|
||||
|
||||
def test_ping_ip_unreachable_osx_10_14_6(self):
|
||||
def test_ping_s_ip_unreachable_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ping <ip>' with host unreachable error on osx 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.osx_10_14_6_ping_ip_unreachable.splitlines(), quiet=True)), self.osx_10_14_6_ping_ip_unreachable_streaming_json)
|
||||
|
||||
def test_ping_ip_unknown_errors_osx_10_14_6(self):
|
||||
def test_ping_s_ip_unknown_errors_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ping <ip>' with unknown/unparsable errors on osx 10.14.6
|
||||
"""
|
||||
@ -725,43 +731,43 @@ class MyTests(unittest.TestCase):
|
||||
with self.assertRaises(IndexError):
|
||||
list(g)
|
||||
|
||||
def test_ping6_hostname_p_osx_10_14_6(self):
|
||||
def test_ping6_s_hostname_p_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ping6 <hostname> -p' on osx 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.osx_10_14_6_ping6_hostname_p.splitlines(), quiet=True)), self.osx_10_14_6_ping6_hostname_p_streaming_json)
|
||||
|
||||
def test_ping6_hostname_s_osx_10_14_6(self):
|
||||
def test_ping6_s_hostname_s_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ping6 <hostname> -s' on osx 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.osx_10_14_6_ping6_hostname_s.splitlines(), quiet=True)), self.osx_10_14_6_ping6_hostname_s_streaming_json)
|
||||
|
||||
def test_ping6_hostname_osx_10_14_6(self):
|
||||
def test_ping6_s_hostname_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ping6 <hostname>' on osx 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.osx_10_14_6_ping6_hostname.splitlines(), quiet=True)), self.osx_10_14_6_ping6_hostname_streaming_json)
|
||||
|
||||
def test_ping6_ip_p_osx_10_14_6(self):
|
||||
def test_ping6_s_ip_p_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ping6 <ip> -p' on osx 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.osx_10_14_6_ping6_ip_p.splitlines(), quiet=True)), self.osx_10_14_6_ping6_ip_p_streaming_json)
|
||||
|
||||
def test_ping6_ip_s_osx_10_14_6(self):
|
||||
def test_ping6_s_ip_s_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ping6 <ip> -s' on osx 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.osx_10_14_6_ping6_ip_s.splitlines(), quiet=True)), self.osx_10_14_6_ping6_ip_s_streaming_json)
|
||||
|
||||
def test_ping6_ip_osx_10_14_6(self):
|
||||
def test_ping6_s_ip_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ping6 <ip>' on osx 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.osx_10_14_6_ping6_ip.splitlines(), quiet=True)), self.osx_10_14_6_ping6_ip_streaming_json)
|
||||
|
||||
def test_ping6_ip_unparsable_osx_10_14_6(self):
|
||||
def test_ping6_s_ip_unparsable_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ping6 <ip>' with unparsable lines on osx 10.14.6
|
||||
"""
|
||||
@ -769,25 +775,25 @@ class MyTests(unittest.TestCase):
|
||||
with self.assertRaises(IndexError):
|
||||
list(g)
|
||||
|
||||
def test_ping_ip_dup_osx_10_14_6(self):
|
||||
def test_ping_s_ip_dup_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ping <ip>' to broadcast IP to get duplicate replies on osx 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.osx_10_14_6_ping_ip_dup.splitlines(), quiet=True)), self.osx_10_14_6_ping_ip_dup_streaming_json)
|
||||
|
||||
def test_ping6_ip_dup_osx_10_14_6(self):
|
||||
def test_ping6_s_ip_dup_osx_10_14_6(self):
|
||||
"""
|
||||
Test 'ping6 <ip>' to broadcast IP to get duplicate replies on osx 10.14.6
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.osx_10_14_6_ping6_ip_dup.splitlines(), quiet=True)), self.osx_10_14_6_ping6_ip_dup_streaming_json)
|
||||
|
||||
def test_ping_ip_O_pi(self):
|
||||
def test_ping_s_ip_O_pi(self):
|
||||
"""
|
||||
Test 'ping6 <ip> -O' on raspberry pi
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.ping_s.parse(self.pi_ping_ip_O.splitlines(), quiet=True)), self.pi_ping_ip_O_streaming_json)
|
||||
|
||||
def test_ping_ip_O_D_pi(self):
|
||||
def test_ping_s_ip_O_D_pi(self):
|
||||
"""
|
||||
Test 'ping6 <ip> -O -D' on raspberry pi
|
||||
"""
|
||||
|
@ -71,65 +71,66 @@ class MyTests(unittest.TestCase):
|
||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/vmstat-1-long-streaming.json'), 'r', encoding='utf-8') as f:
|
||||
self.ubuntu_18_04_vmstat_1_long_streaming_json = json.loads(f.read())
|
||||
|
||||
def test_vmstat_nodata(self):
|
||||
def test_vmstat_s_nodata(self):
|
||||
"""
|
||||
Test 'vmstat' with no data
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.vmstat_s.parse('', quiet=True)), [])
|
||||
|
||||
def test_vmstat_unparsable(self):
|
||||
def test_vmstat_s_unparsable(self):
|
||||
data = 'unparsable data'
|
||||
g = jc.parsers.vmstat_s.parse(data.splitlines(), quiet=True)
|
||||
with self.assertRaises(ParseError):
|
||||
list(g)
|
||||
|
||||
def test_vmstat_centos_7_7(self):
|
||||
def test_vmstat_s_centos_7_7(self):
|
||||
"""
|
||||
Test 'vmstat' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.vmstat_s.parse(self.centos_7_7_vmstat.splitlines(), quiet=True)), self.centos_7_7_vmstat_streaming_json)
|
||||
|
||||
def test_vmstat_a_centos_7_7(self):
|
||||
def test_vmstat_s_a_centos_7_7(self):
|
||||
"""
|
||||
Test 'vmstat -a' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.vmstat_s.parse(self.centos_7_7_vmstat_a.splitlines(), quiet=True)), self.centos_7_7_vmstat_a_streaming_json)
|
||||
|
||||
def test_vmstat_w_centos_7_7(self):
|
||||
def test_vmstat_s_w_centos_7_7(self):
|
||||
"""
|
||||
Test 'vmstat -w' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.vmstat_s.parse(self.centos_7_7_vmstat_w.splitlines(), quiet=True)), self.centos_7_7_vmstat_w_streaming_json)
|
||||
|
||||
def test_vmstat_at_5_10_centos_7_7(self):
|
||||
def test_vmstat_s_at_5_10_centos_7_7(self):
|
||||
"""
|
||||
Test 'vmstat -at 5 10' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.vmstat_s.parse(self.centos_7_7_vmstat_at_5_10.splitlines(), quiet=True)), self.centos_7_7_vmstat_at_5_10_streaming_json)
|
||||
|
||||
def test_vmstat_awt_centos_7_7(self):
|
||||
def test_vmstat_s_awt_centos_7_7(self):
|
||||
"""
|
||||
Test 'vmstat -awt' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.vmstat_s.parse(self.centos_7_7_vmstat_awt.splitlines(), quiet=True)), self.centos_7_7_vmstat_awt_streaming_json)
|
||||
|
||||
def test_vmstat_d_centos_7_7(self):
|
||||
def test_vmstat_s_d_centos_7_7(self):
|
||||
"""
|
||||
Test 'vmstat -d' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.vmstat_s.parse(self.centos_7_7_vmstat_d.splitlines(), quiet=True)), self.centos_7_7_vmstat_d_streaming_json)
|
||||
|
||||
def test_vmstat_dt_centos_7_7(self):
|
||||
def test_vmstat_s_dt_centos_7_7(self):
|
||||
"""
|
||||
Test 'vmstat -dt' on Centos 7.7
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.vmstat_s.parse(self.centos_7_7_vmstat_dt.splitlines(), quiet=True)), self.centos_7_7_vmstat_dt_streaming_json)
|
||||
|
||||
def test_vmstat_1_long_ubuntu_18_04(self):
|
||||
def test_vmstat_s_1_long_ubuntu_18_04(self):
|
||||
"""
|
||||
Test 'vmstat -1' (on ubuntu) with long output that reprints the header rows
|
||||
"""
|
||||
self.assertEqual(list(jc.parsers.vmstat_s.parse(self.ubuntu_18_04_vmstat_1_long.splitlines(), quiet=True)), self.ubuntu_18_04_vmstat_1_long_streaming_json)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Reference in New Issue
Block a user