@@ -49,8 +49,7 @@ def test_successful_execution(self, mock_logger, mock_firehose_logger):
4949
5050 # Assert
5151 self .assertEqual (result , "Success" )
52- self .assertEqual (mock_logger .info .call_count , 2 )
53-
52+ mock_logger .info .assert_called ()
5453 mock_firehose_logger .send_log .assert_called ()
5554
5655 args , kwargs = mock_logger .info .call_args
@@ -66,6 +65,34 @@ def test_successful_execution(self, mock_logger, mock_firehose_logger):
6665 self .assertEqual (logged_info ['local_id' ], '12345^http://test' )
6766 self .assertEqual (logged_info ['vaccine_type' ], 'FLU' )
6867
68+ def test_successful_execution_logger (self , mock_logger , mock_firehose_logger ):
69+ # Arrange
70+ test_correlation = "test_correlation"
71+ test_request = "test_request"
72+ test_supplier = "test_supplier"
73+ test_actual_path = "/test"
74+ test_resource_path = "/test"
75+
76+ self .mock_redis_client .hget .return_value = "FLU"
77+ wrapped_function = function_info (self .mock_success_function )
78+ event = {
79+ 'headers' : {
80+ 'X-Correlation-ID' : test_correlation ,
81+ 'X-Request-ID' : test_request ,
82+ 'SupplierSystem' : test_supplier
83+ },
84+ 'path' : test_actual_path ,
85+ 'requestContext' : {'resourcePath' : test_resource_path },
86+ 'body' : "{\" identifier\" : [{\" system\" : \" http://test\" , \" value\" : \" 12345\" }], \" protocolApplied\" : [{\" targetDisease\" : [{\" coding\" : [{\" system\" : \" http://snomed.info/sct\" , \" code\" : \" 840539006\" , \" display\" : \" Disease caused by severe acute respiratory syndrome coronavirus 2\" }]}]}]}"
87+ }
88+
89+ # Act
90+ result = wrapped_function (event , {})
91+
92+ # Assert
93+ self .assertEqual (result , "Success" )
94+ self .assertEqual (mock_logger .info .call_count , 2 )
95+
6996 def test_exception_handling (self , mock_logger , mock_firehose_logger ):
7097 # Arrange
7198 test_correlation = "failed_test_correlation"
0 commit comments