@@ -3592,6 +3592,7 @@ def test_can_create_kinesis_event_source(stubbed_session):
35923592 FunctionName = function_name ,
35933593 BatchSize = batch_size ,
35943594 StartingPosition = starting_position ,
3595+ MaximumBatchingWindowInSeconds = 0
35953596 ).returns ({'UUID' : 'my-uuid' })
35963597
35973598 stubbed_session .activate_stubs ()
@@ -3603,22 +3604,52 @@ def test_can_create_kinesis_event_source(stubbed_session):
36033604 stubbed_session .verify_stubs ()
36043605
36053606
3607+ def test_can_create_kinesis_event_source_batching_window (stubbed_session ):
3608+ kinesis_arn = 'arn:aws:kinesis:us-west-2:...:stream/MyStream'
3609+ function_name = 'myfunction'
3610+ batch_size = 100
3611+ starting_position = 'TRIM_HORIZON'
3612+ maximum_batching_window_in_seconds = 60
3613+
3614+ lambda_stub = stubbed_session .stub ('lambda' )
3615+ lambda_stub .create_event_source_mapping (
3616+ EventSourceArn = kinesis_arn ,
3617+ FunctionName = function_name ,
3618+ BatchSize = batch_size ,
3619+ StartingPosition = starting_position ,
3620+ MaximumBatchingWindowInSeconds = maximum_batching_window_in_seconds
3621+
3622+ ).returns ({'UUID' : 'my-uuid' })
3623+
3624+ stubbed_session .activate_stubs ()
3625+ client = TypedAWSClient (stubbed_session )
3626+ result = client .create_lambda_event_source (
3627+ kinesis_arn , function_name , batch_size , starting_position ,
3628+ maximum_batching_window_in_seconds
3629+ )
3630+ assert result == 'my-uuid'
3631+ stubbed_session .verify_stubs ()
3632+
3633+
36063634def test_can_create_sqs_event_source (stubbed_session ):
36073635 queue_arn = 'arn:sqs:queue-name'
36083636 function_name = 'myfunction'
36093637 batch_size = 100
3638+ maximum_batching_window_in_seconds = 60
36103639
36113640 lambda_stub = stubbed_session .stub ('lambda' )
36123641 lambda_stub .create_event_source_mapping (
36133642 EventSourceArn = queue_arn ,
36143643 FunctionName = function_name ,
3615- BatchSize = batch_size
3644+ BatchSize = batch_size ,
3645+ MaximumBatchingWindowInSeconds = maximum_batching_window_in_seconds
36163646 ).returns ({'UUID' : 'my-uuid' })
36173647
36183648 stubbed_session .activate_stubs ()
36193649 client = TypedAWSClient (stubbed_session )
36203650 result = client .create_lambda_event_source (
3621- queue_arn , function_name , batch_size
3651+ queue_arn , function_name , batch_size ,
3652+ maximum_batching_window_in_seconds = maximum_batching_window_in_seconds
36223653 )
36233654 assert result == 'my-uuid'
36243655 stubbed_session .verify_stubs ()
@@ -3633,7 +3664,8 @@ def test_can_retry_create_sqs_event_source(stubbed_session):
36333664 lambda_stub .create_event_source_mapping (
36343665 EventSourceArn = queue_arn ,
36353666 FunctionName = function_name ,
3636- BatchSize = batch_size
3667+ BatchSize = batch_size ,
3668+ MaximumBatchingWindowInSeconds = 0
36373669 ).raises_error (
36383670 error_code = 'InvalidParameterValueException' ,
36393671 message = ('The provided execution role does not '
@@ -3642,7 +3674,8 @@ def test_can_retry_create_sqs_event_source(stubbed_session):
36423674 lambda_stub .create_event_source_mapping (
36433675 EventSourceArn = queue_arn ,
36443676 FunctionName = function_name ,
3645- BatchSize = batch_size
3677+ BatchSize = batch_size ,
3678+ MaximumBatchingWindowInSeconds = 0
36463679 ).returns ({'UUID' : 'my-uuid' })
36473680
36483681 stubbed_session .activate_stubs ()
@@ -3710,6 +3743,7 @@ def test_can_retry_update_event_source(stubbed_session):
37103743 lambda_stub .update_event_source_mapping (
37113744 UUID = 'my-uuid' ,
37123745 BatchSize = 5 ,
3746+ MaximumBatchingWindowInSeconds = 0 ,
37133747 ).returns ({})
37143748
37153749 stubbed_session .activate_stubs ()
@@ -3720,6 +3754,23 @@ def test_can_retry_update_event_source(stubbed_session):
37203754 stubbed_session .verify_stubs ()
37213755
37223756
3757+ def test_can_retry_update_event_source_batching_window (stubbed_session ):
3758+ lambda_stub = stubbed_session .stub ('lambda' )
3759+ lambda_stub .update_event_source_mapping (
3760+ UUID = 'my-uuid' ,
3761+ BatchSize = 5 ,
3762+ MaximumBatchingWindowInSeconds = 60 ,
3763+ ).returns ({})
3764+
3765+ stubbed_session .activate_stubs ()
3766+ client = TypedAWSClient (stubbed_session )
3767+ client .update_lambda_event_source (
3768+ event_uuid = 'my-uuid' , batch_size = 5 ,
3769+ maximum_batching_window_in_seconds = 60
3770+ )
3771+ stubbed_session .verify_stubs ()
3772+
3773+
37233774@pytest .mark .parametrize ('resource_name,service_name,is_verified' , [
37243775 ('queue-name' , 'sqs' , True ),
37253776 ('queue-name' , 'not-sqs' , False ),
@@ -3815,11 +3866,13 @@ def test_can_update_lambda_event_source(stubbed_session):
38153866 lambda_stub .update_event_source_mapping (
38163867 UUID = 'my-uuid' ,
38173868 BatchSize = 5 ,
3869+ MaximumBatchingWindowInSeconds = 60 ,
38183870 ).returns ({})
38193871
38203872 stubbed_session .activate_stubs ()
38213873 client = TypedAWSClient (stubbed_session )
38223874 client .update_lambda_event_source (
3823- event_uuid = 'my-uuid' , batch_size = 5
3875+ event_uuid = 'my-uuid' , batch_size = 5 ,
3876+ maximum_batching_window_in_seconds = 60
38243877 )
38253878 stubbed_session .verify_stubs ()
0 commit comments