✨ Extra touch
This commit is contained in:
@ -1164,6 +1164,7 @@ class NetworkMonitorTests(unittest.TestCase):
|
||||
def testNetworkMonitorEventIdentification(self)->None:
|
||||
localhost = "127.0.0.1"
|
||||
port = 8181
|
||||
test_packet = b'test'
|
||||
|
||||
from_monitor_reader, from_monitor_writer = Pipe()
|
||||
|
||||
@ -1191,7 +1192,7 @@ class NetworkMonitorTests(unittest.TestCase):
|
||||
|
||||
sender = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sender.connect((localhost,port))
|
||||
sender.sendall(b'test')
|
||||
sender.sendall(test_packet)
|
||||
sender.close()
|
||||
|
||||
if from_monitor_reader.poll(3):
|
||||
@ -1213,6 +1214,11 @@ class NetworkMonitorTests(unittest.TestCase):
|
||||
self.assertEqual(event[TRIGGERING_PORT], port)
|
||||
self.assertEqual(event[EVENT_RULE].name, rule.name)
|
||||
|
||||
with open(event[EVENT_PATH], "rb") as file_pointer:
|
||||
received_packet = file_pointer.read()
|
||||
|
||||
self.assertEqual(received_packet, test_packet)
|
||||
|
||||
monitor.stop()
|
||||
|
||||
# Test NetworkMonitor get_patterns function
|
||||
|
Reference in New Issue
Block a user