@@ -351,7 +351,7 @@ def test_single_error_in_multi(self):
351351 self .assertFalse (result )
352352 self .assertEqual (self .mock_delta_table .put_item .call_count , 3 )
353353 self .assertEqual (self .mock_firehose_logger .send_log .call_count , 3 )
354- self .assertEqual (self .mock_logger_exception .call_count , 1 )
354+ self .assertEqual (self .mock_logger_error .call_count , 1 )
355355
356356 def test_single_exception_in_multi (self ):
357357 # Arrange
@@ -448,12 +448,15 @@ def setUp(self):
448448 self .logger_info_patcher = patch ("logging.Logger.info" )
449449 self .mock_logger_info = self .logger_info_patcher .start ()
450450
451- self .logger_exception_patcher = patch ("logging.Logger.exception" )
452- self .mock_logger_exception = self .logger_exception_patcher .start ()
453-
454451 self .logger_warning_patcher = patch ("logging.Logger.warning" )
455452 self .mock_logger_warning = self .logger_warning_patcher .start ()
456453
454+ self .logger_error_patcher = patch ("logging.Logger.error" )
455+ self .mock_logger_error = self .logger_error_patcher .start ()
456+
457+ self .logger_exception_patcher = patch ("logging.Logger.exception" )
458+ self .mock_logger_exception = self .logger_exception_patcher .start ()
459+
457460 self .delta_table_patcher = patch ("delta.delta_table" )
458461 self .mock_delta_table = self .delta_table_patcher .start ()
459462
@@ -521,7 +524,7 @@ def test_multi_record_success_with_fail(self):
521524 self .assertEqual (result , expected_returns [test_index - 1 ])
522525 self .assertEqual (self .mock_delta_table .put_item .call_count , test_index )
523526
524- self .assertEqual (self .mock_logger_exception .call_count , 1 )
527+ self .assertEqual (self .mock_logger_error .call_count , 1 )
525528
526529
527530 def test_single_record_table_exception (self ):
@@ -534,7 +537,7 @@ def test_single_record_table_exception(self):
534537 operation = Operation .UPDATE ,
535538 supplier = "EMIS" ,
536539 )
537- self .mock_delta_table .put_item .return_value = EXCEPTION_RESPONSE
540+ self .mock_delta_table .put_item .side_effect = EXCEPTION_RESPONSE
538541 # Act
539542 result , operation_outcome = process_record (record )
540543
@@ -543,7 +546,7 @@ def test_single_record_table_exception(self):
543546 self .assertEqual (operation_outcome ["record" ], imms_id )
544547 self .assertEqual (operation_outcome ["operation_type" ], Operation .UPDATE )
545548 self .assertEqual (operation_outcome ["statusCode" ], "500" )
546- self .assertEqual (operation_outcome ["statusDesc" ], "Failure response from DynamoDB " )
549+ self .assertEqual (operation_outcome ["statusDesc" ], "Exception " )
547550 self .assertEqual (self .mock_delta_table .put_item .call_count , 1 )
548551 self .assertEqual (self .mock_logger_exception .call_count , 1 )
549552
0 commit comments