@@ -164,29 +164,28 @@ def test_handler_multi_record(self):
164164 with patch .object (self .mock_get_s3_records ,
165165 "return_value" ,
166166 [S3EventRecord (self .s3_vaccine ), S3EventRecord (self .s3_supplier )]):
167- # repatch mock_record_processor
168- with patch ("redis_sync.process_record" ) as mock_record_processor :
169- # Mock the return value for each record
170- mock_record_processor .side_effect = [
171- {'status' : 'success' , 'message' : 'Processed successfully' ,
172- 'file_key' : RedisCacheKey .DISEASE_MAPPING_FILE_KEY },
173- {'status' : 'success' , 'message' : 'Processed successfully' ,
174- 'file_key' : RedisCacheKey .PERMISSIONS_CONFIG_FILE_KEY }
175- ]
176-
177- handler (mock_event , None )
178-
179- # Get put_record arguments
180- args , kwargs = self .mock_firehose_client .put_record .call_args
181- record = kwargs .get ("Record" ) or args [1 ]
182- data_bytes = record ["Data" ]
183- log_json = data_bytes .decode ("utf-8" )
184- log_dict = json .loads (log_json )
185- # check expected content
186- event = log_dict ["event" ]
187- self .assertIn ("function_name" , event )
188- self .assertEqual (event ["function_name" ], "redis_sync_handler" )
189- self .assertEqual (event ["status" ], "success" )
167+
168+ # Mock the return value for each record
169+ self .mock_record_processor .side_effect = [
170+ {'status' : 'success' , 'message' : 'Processed successfully' ,
171+ 'file_key' : RedisCacheKey .DISEASE_MAPPING_FILE_KEY },
172+ {'status' : 'success' , 'message' : 'Processed successfully' ,
173+ 'file_key' : RedisCacheKey .PERMISSIONS_CONFIG_FILE_KEY }
174+ ]
175+
176+ handler (mock_event , None )
177+
178+ # Get put_record arguments
179+ args , kwargs = self .mock_firehose_client .put_record .call_args
180+ record = kwargs .get ("Record" ) or args [1 ]
181+ data_bytes = record ["Data" ]
182+ log_json = data_bytes .decode ("utf-8" )
183+ log_dict = json .loads (log_json )
184+ # check expected content
185+ event = log_dict ["event" ]
186+ self .assertIn ("function_name" , event )
187+ self .assertEqual (event ["function_name" ], "redis_sync_handler" )
188+ self .assertEqual (event ["status" ], "success" )
190189
191190 # test to check that event_read is called when "read" key is passed in the event
192191 def test_handler_read_event (self ):
0 commit comments