Extra touch

This commit is contained in:
NikolajDanger
2023-05-29 19:51:01 +02:00
parent afa764ad67
commit 4723482dbc
2 changed files with 19 additions and 1 deletions

View File

@ -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