aboutsummaryrefslogtreecommitdiffstats
path: root/test/suite_dissection.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/suite_dissection.py')
-rw-r--r--test/suite_dissection.py54
1 files changed, 27 insertions, 27 deletions
diff --git a/test/suite_dissection.py b/test/suite_dissection.py
index 207e32efba..2dedd4d3fa 100644
--- a/test/suite_dissection.py
+++ b/test/suite_dissection.py
@@ -9,36 +9,38 @@
#
'''Dissection tests'''
-import config
import os.path
import subprocesstest
import unittest
+import fixtures
+@fixtures.mark_usefixtures('test_env')
+@fixtures.uses_fixtures
class case_dissect_http2(subprocesstest.SubprocessTestCase):
- def test_http2_data_reassembly(self):
+ def test_http2_data_reassembly(self, cmd_tshark, features, dirs):
'''HTTP2 data reassembly'''
- if not config.have_nghttp2:
+ if not features.have_nghttp2:
self.skipTest('Requires nghttp2.')
- capture_file = os.path.join(config.capture_dir, 'http2-data-reassembly.pcap')
- key_file = os.path.join(config.key_dir, 'http2-data-reassembly.keys')
- self.runProcess((config.cmd_tshark,
+ capture_file = os.path.join(dirs.capture_dir, 'http2-data-reassembly.pcap')
+ key_file = os.path.join(dirs.key_dir, 'http2-data-reassembly.keys')
+ self.runProcess((cmd_tshark,
'-r', capture_file,
'-o', 'tls.keylog_file: {}'.format(key_file),
'-d', 'tcp.port==8443,tls',
'-Y', 'http2.data.data matches "PNG" && http2.data.data matches "END"',
- ),
- env=config.test_env)
+ ))
self.assertTrue(self.grepOutput('DATA'))
+@fixtures.mark_usefixtures('test_env')
+@fixtures.uses_fixtures
class case_dissect_tcp(subprocesstest.SubprocessTestCase):
- def check_tcp_out_of_order(self, extraArgs=[]):
- capture_file = os.path.join(config.capture_dir, 'http-ooo.pcap')
- self.runProcess([config.cmd_tshark,
+ def check_tcp_out_of_order(self, cmd_tshark, dirs, extraArgs=[]):
+ capture_file = os.path.join(dirs.capture_dir, 'http-ooo.pcap')
+ self.runProcess([cmd_tshark,
'-r', capture_file,
'-otcp.reassemble_out_of_order:TRUE',
'-Y', 'http',
- ] + extraArgs,
- env=config.test_env)
+ ] + extraArgs)
self.assertEqual(self.countOutput('HTTP'), 5)
# TODO PDU /1 (segments in frames 1, 2, 4) should be reassembled in
# frame 4, but it is currently done in frame 6 because the current
@@ -50,24 +52,23 @@ class case_dissect_tcp(subprocesstest.SubprocessTestCase):
self.assertTrue(self.grepOutput(r'^\s*11\s.*PUT /4 HTTP/1.1'))
self.assertTrue(self.grepOutput(r'^\s*15\s.*PUT /5 HTTP/1.1'))
- def test_tcp_out_of_order_onepass(self):
- self.check_tcp_out_of_order()
+ def test_tcp_out_of_order_onepass(self, cmd_tshark, dirs):
+ self.check_tcp_out_of_order(cmd_tshark, dirs)
@unittest.skip("MSP splitting is not implemented yet")
- def test_tcp_out_of_order_twopass(self):
- self.check_tcp_out_of_order(extraArgs=['-2'])
+ def test_tcp_out_of_order_twopass(self, cmd_tshark, dirs):
+ self.check_tcp_out_of_order(cmd_tshark, dirs, extraArgs=['-2'])
- def test_tcp_out_of_order_twopass_with_bug(self):
+ def test_tcp_out_of_order_twopass_with_bug(self, cmd_tshark, dirs):
# TODO fix the issue below, remove this and enable
# "test_tcp_out_of_order_twopass"
- capture_file = os.path.join(config.capture_dir, 'http-ooo.pcap')
- self.runProcess((config.cmd_tshark,
+ capture_file = os.path.join(dirs.capture_dir, 'http-ooo.pcap')
+ self.runProcess((cmd_tshark,
'-r', capture_file,
'-otcp.reassemble_out_of_order:TRUE',
'-Y', 'http',
'-2',
- ),
- env=config.test_env)
+ ))
self.assertEqual(self.countOutput('HTTP'), 3)
self.assertTrue(self.grepOutput(r'^\s*7\s.*PUT /1 HTTP/1.1'))
self.assertTrue(self.grepOutput(r'^\s*7\s.*GET /2 HTTP/1.1'))
@@ -80,13 +81,12 @@ class case_dissect_tcp(subprocesstest.SubprocessTestCase):
self.assertTrue(self.grepOutput(r'^\s*11\s.*PUT /4 HTTP/1.1'))
self.assertTrue(self.grepOutput(r'^\s*15\s.*PUT /5 HTTP/1.1'))
- def test_tcp_out_of_order_data_after_syn(self):
+ def test_tcp_out_of_order_data_after_syn(self, cmd_tshark, dirs):
'''Test when the first non-empty segment is OoO.'''
- capture_file = os.path.join(config.capture_dir, 'dns-ooo.pcap')
- proc = self.runProcess((config.cmd_tshark,
+ capture_file = os.path.join(dirs.capture_dir, 'dns-ooo.pcap')
+ proc = self.runProcess((cmd_tshark,
'-r', capture_file,
'-otcp.reassemble_out_of_order:TRUE',
'-Y', 'dns', '-Tfields', '-edns.qry.name',
- ),
- env=config.test_env)
+ ))
self.assertEqual(proc.stdout_str.strip(), 'example.com')