88 parse_execve ,
99 setup_logging ,
1010 LinuxEDRApp ,
11- ExecveEvent ,
1211 SyscallTracer ,
1312)
1413
14+ from linux_edr .domain .models .event_models import ExecveEvent
15+
1516
1617class TestApp (unittest .TestCase ):
1718
@@ -259,7 +260,7 @@ def test_process_event(self, mock_parse_execve, mock_log_info, mock_log_debug):
259260 app .agg = MagicMock ()
260261
261262 # Setup mock for parse_execve
262- parsed_event = ExecveEvent ("12345.6789" , 1000 , "test_cmd" , ["-a" , "-b" ])
263+ parsed_event = ExecveEvent (timestamp = "12345.6789" , pid = 1000 , command = "test_cmd" , args = ["-a" , "-b" ])
263264 mock_parse_execve .return_value = parsed_event
264265
265266 # Import the method to test it independently
@@ -268,23 +269,28 @@ def test_process_event(self, mock_parse_execve, mock_log_info, mock_log_debug):
268269 # Call the method directly
269270 LinuxEDRApp ._process_event (app , "test_event" )
270271
271- # Verify debug logging
272- app .agg .add .assert_called_once_with ("test_event" )
273- self .assertTrue (mock_log_debug .called )
272+ # The aggregator should receive a validated dict version of the parsed event
273+ expected_dict = {
274+ "timestamp" : "12345.6789" ,
275+ "pid" : 1000 ,
276+ "command" : "test_cmd" ,
277+ "args" : ["-a" , "-b" ],
278+ }
279+ app .agg .add .assert_called_once_with (expected_dict )
274280
275281 # Reset mock and test with verbose_debug=False
276282 mock_log_debug .reset_mock ()
277283 app .verbose_debug = False
278284
279285 LinuxEDRApp ._process_event (app , "test_event2" )
280- app .agg .add .assert_called_with ("test_event2" )
286+ app .agg .add .assert_called_with (expected_dict )
281287
282288 # Test with debug=False
283289 mock_log_debug .reset_mock ()
284290 app .debug = False
285291
286292 LinuxEDRApp ._process_event (app , "test_event3" )
287- app .agg .add .assert_called_with ("test_event3" )
293+ app .agg .add .assert_called_with (expected_dict )
288294 mock_log_debug .assert_not_called ()
289295
290296
0 commit comments