File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -415,3 +415,30 @@ def test_single_exception_in_multi(self, mock_boto_resource):
415415 self .assertEqual (mock_table .put_item .call_count , 3 )
416416 self .assertEqual (self .mock_firehose_logger .send_log .call_count , 2 )
417417 self .assertEqual (self .mock_logger_exception .call_count , 1 )
418+
419+ @patch ("delta.process_record" )
420+ @patch ("boto3.resource" )
421+ def test_handler_calls_process_record_for_each_event (self , mock_boto_resource , mock_process_record ):
422+ # Arrange
423+ mock_delta_table = MagicMock ()
424+ mock_boto_resource .return_value .Table .return_value = mock_delta_table
425+
426+ # Create an event with 3 records
427+ event = {
428+ "Records" : [
429+ { "a" : "record1" },
430+ { "a" : "record2" },
431+ { "a" : "record3" }
432+ ]
433+ }
434+ context = {}
435+
436+ # Mock process_record to always return True
437+ mock_process_record .return_value = True
438+
439+ # Act
440+ result = handler (event , context )
441+
442+ # Assert
443+ self .assertTrue (result )
444+ self .assertEqual (mock_process_record .call_count , len (event ["Records" ]))
You can’t perform that action at this time.
0 commit comments