Test: Fix a test on macOS

The error message can vary so fix the test to reflect that.
This commit is contained in:
João Valverde 2023-05-13 14:46:45 +01:00
parent e36225aea5
commit 2d2d5048a5
1 changed files with 4 additions and 2 deletions

View File

@ -62,7 +62,8 @@ class case_dumpcap_capture_clopts(subprocesstest.SubprocessTestCase):
# $DUMPCAP -i invalid_interface -w './testout.pcap' > ./testout.txt 2>&1
testout_file = result_file(testout_pcap)
self.runProcess((cmd_dumpcap, '-i', invalid_interface, '-w', testout_file))
self.assertTrue(self.grepOutput('The capture session could not be initiated on capture device "__invalid_interface"'))
self.assertTrue(self.grepOutput('There is no device named "__invalid_interface"') or
self.grepOutput('The capture session could not be initiated on capture device "__invalid_interface"'))
def test_dumpcap_invalid_interface_index(self, cmd_dumpcap, capture_interface, result_file):
'''Invalid capture interface index'''
@ -128,7 +129,8 @@ class case_tshark_capture_clopts(subprocesstest.SubprocessTestCase):
# $TSHARK -i invalid_interface -w './testout.pcap' > ./testout.txt 2>&1
testout_file = result_file(testout_pcap)
self.runProcess((cmd_tshark, '-i', invalid_interface, '-w', testout_file))
self.assertTrue(self.grepOutput('The capture session could not be initiated on capture device "__invalid_interface"'))
self.assertTrue(self.grepOutput('There is no device named "__invalid_interface"') or
self.grepOutput('The capture session could not be initiated on capture device "__invalid_interface"'))
def test_tshark_invalid_interface_index(self, cmd_tshark, capture_interface, result_file):
'''Invalid capture interface index'''