@@ -101,35 +101,74 @@ def test_batch_submit_job_step_creation():
101101
102102
103103@patch .object (boto3 .session .Session , 'region_name' , 'us-east-1' )
104- def test_ecs_run_task_step_creation ():
105- step = EcsRunTaskStep ('Ecs Job' , wait_for_completion = False )
104+ @pytest .mark .parametrize (
105+ ("task_kwargs" ,),
106+ [
107+ ({}),
108+ ({
109+ "integration_pattern" : IntegrationPattern .WaitForCompletion ,
110+ "wait_for_completion" : False ,
111+ }),
112+ ]
113+ )
114+ def test_ecs_run_task_with_wait_for_completion (task_kwargs ):
115+ step = EcsRunTaskStep ('ECS Job' , ** task_kwargs )
116+
106117 assert step .to_dict () == {
107118 'Type' : 'Task' ,
108- 'Resource' : 'arn:aws:states:::ecs:runTask' ,
119+ 'Resource' : 'arn:aws:states:::ecs:runTask.sync' ,
120+ 'Parameters' : {
121+ 'TaskDefinition' : 'Task'
122+ },
109123 'End' : True
110124 }
111125
112- step = EcsRunTaskStep ('Ecs Job' ,
113- integration_pattern = IntegrationPattern .WaitForTaskToken ,
114- wait_for_completion = False )
126+
127+ @patch .object (boto3 .session .Session , 'region_name' , 'us-east-1' )
128+ @pytest .mark .parametrize (
129+ ("task_kwargs" ,),
130+ [
131+ ({
132+ "integration_pattern" : IntegrationPattern .WaitForTaskToken ,
133+ "wait_for_completion" : False ,
134+ }),
135+ ]
136+ )
137+ def test_ecs_run_task_with_wait_for_task_token (task_kwargs ):
138+ step = EcsRunTaskStep ('ECS Job' , ** task_kwargs )
139+
115140 assert step .to_dict () == {
116141 'Type' : 'Task' ,
117142 'Resource' : 'arn:aws:states:::ecs:runTask.waitForTaskToken' ,
118143 'End' : True
119144 }
120145
121- step = EcsRunTaskStep ('Ecs Job' , parameters = {
122- 'TaskDefinition' : 'Task'
123- })
146+
147+ @patch .object (boto3 .session .Session , 'region_name' , 'us-east-1' )
148+ @pytest .mark .parametrize (
149+ ("task_kwargs" ,),
150+ [
151+ ({
152+ "wait_for_completion" : False ,
153+ }),
154+ ({
155+ "integration_pattern" : IntegrationPattern .CallAndContinue ,
156+ "wait_for_completion" : False ,
157+ })
158+ ]
159+ )
160+ def test_ecs_run_task_with_call_and_continue (task_kwargs ):
161+ step = EcsRunTaskStep ('ECS Job' , ** task_kwargs )
162+
124163 assert step .to_dict () == {
125164 'Type' : 'Task' ,
126- 'Resource' : 'arn:aws:states:::ecs:runTask.sync' ,
127- 'Parameters' : {
128- 'TaskDefinition' : 'Task'
129- },
165+ 'Resource' : 'arn:aws:states:::ecs:runTask' ,
130166 'End' : True
131167 }
132168
169+
170+ @patch .object (boto3 .session .Session , 'region_name' , 'us-east-1' )
171+ def test_ecs_run_task_with_conflicting_arguments ():
133172 with pytest .raises (ValueError ):
134173 step = EcsRunTaskStep ('Ecs Job' ,
135174 wait_for_completion = True ,
0 commit comments