99from boto3 import client as boto3_client
1010from moto import mock_aws
1111
12- from tests . utils .generic_setup_and_teardown_for_ack_backend import (
12+ from utils .generic_setup_and_teardown_for_ack_backend import (
1313 GenericSetUp ,
1414 GenericTearDown ,
1515)
16- from tests . utils .mock_environment_variables import MOCK_ENVIRONMENT_DICT , BucketNames
17- from tests . utils .utils_for_ack_backend_tests import generate_event
18- from tests . utils .values_for_ack_backend_tests import (
16+ from utils .mock_environment_variables import MOCK_ENVIRONMENT_DICT , BucketNames
17+ from utils .utils_for_ack_backend_tests import generate_event
18+ from utils .values_for_ack_backend_tests import (
1919 EXPECTED_ACK_LAMBDA_RESPONSE_FOR_SUCCESS ,
2020 DiagnosticsDictionaries ,
2121 InvalidValues ,
@@ -120,7 +120,6 @@ def test_splunk_logging_successful_rows(self):
120120 for operation in ["CREATE" , "UPDATE" , "DELETE" ]:
121121 with ( # noqa: E999
122122 patch ("common.log_decorator.send_log_to_firehose" ) as mock_send_log_to_firehose , # noqa: E999
123- patch ("ack_processor.is_ack_processing_complete" , return_value = False ),
124123 patch ("common.log_decorator.logger" ) as mock_logger , # noqa: E999
125124 ): # noqa: E999
126125 result = lambda_handler (
@@ -224,7 +223,6 @@ def test_splunk_logging_statuscode_diagnostics(
224223 for test_case in test_cases :
225224 with ( # noqa: E999
226225 patch ("common.log_decorator.send_log_to_firehose" ) as mock_send_log_to_firehose , # noqa: E999
227- patch ("ack_processor.is_ack_processing_complete" , return_value = False ),
228226 patch ("common.log_decorator.logger" ) as mock_logger , # noqa: E999
229227 ): # noqa: E999
230228 result = lambda_handler (
@@ -262,7 +260,6 @@ def test_splunk_logging_multiple_rows(self):
262260
263261 with ( # noqa: E999
264262 patch ("common.log_decorator.send_log_to_firehose" ) as mock_send_log_to_firehose , # noqa: E999
265- patch ("ack_processor.is_ack_processing_complete" , return_value = False ),
266263 patch ("common.log_decorator.logger" ) as mock_logger , # noqa: E999
267264 ): # noqa: E999
268265 result = lambda_handler (generate_event (messages ), context = {})
@@ -313,7 +310,6 @@ def test_splunk_logging_multiple_with_diagnostics(
313310
314311 with ( # noqa: E999
315312 patch ("common.log_decorator.send_log_to_firehose" ) as mock_send_log_to_firehose , # noqa: E999
316- patch ("ack_processor.is_ack_processing_complete" , return_value = False ),
317313 patch ("common.log_decorator.logger" ) as mock_logger , # noqa: E999
318314 ): # noqa: E999
319315 result = lambda_handler (generate_event (messages ), context = {})
@@ -369,7 +365,6 @@ def test_splunk_logging_multiple_with_diagnostics(
369365 )
370366
371367 def test_splunk_update_ack_file_not_logged (self ):
372- self .maxDiff = None
373368 """Tests that update_ack_file is not logged if we have sent acks for less than the whole file"""
374369 # send 98 messages
375370 messages = []
@@ -380,7 +375,6 @@ def test_splunk_update_ack_file_not_logged(self):
380375 with ( # noqa: E999
381376 patch ("common.log_decorator.send_log_to_firehose" ) as mock_send_log_to_firehose , # noqa: E999
382377 patch ("common.log_decorator.logger" ) as mock_logger , # noqa: E999
383- patch ("ack_processor.is_ack_processing_complete" , return_value = False ),
384378 patch (
385379 "update_ack_file.change_audit_table_status_to_processed"
386380 ) as mock_change_audit_table_status_to_processed , # noqa: E999
@@ -421,12 +415,12 @@ def test_splunk_update_ack_file_logged(self):
421415 with ( # noqa: E999
422416 patch ("common.log_decorator.send_log_to_firehose" ) as mock_send_log_to_firehose , # noqa: E999
423417 patch ("common.log_decorator.logger" ) as mock_logger , # noqa: E999
424- patch ("ack_processor.is_ack_processing_complete " , return_value = True ),
418+ patch ("update_ack_file.get_record_count_by_message_id " , return_value = 99 ),
425419 patch (
426420 "update_ack_file.change_audit_table_status_to_processed"
427421 ) as mock_change_audit_table_status_to_processed , # noqa: E999
428422 ): # noqa: E999
429- result = lambda_handler (generate_event (messages ), context = {})
423+ result = lambda_handler (generate_event (messages , include_eof_message = True ), context = {})
430424
431425 self .assertEqual (result , EXPECTED_ACK_LAMBDA_RESPONSE_FOR_SUCCESS )
432426
0 commit comments