@@ -64,7 +64,7 @@ def test_flow_info(echo):
6464 load_keychain = False ,
6565 )
6666
67- run_click_command (flow .flow_info , runtime = runtime , flow_name = "test" )
67+ run_click_command (flow .flow_info , runtime = runtime , flow_name = "test" , extra_yaml = () )
6868
6969 echo .assert_called_with (
7070 "\n Flow Steps\n 1) task: test_task [from current folder]\n options:\n option_name: option_value"
@@ -75,7 +75,36 @@ def test_flow_info__not_found():
7575 runtime = mock .Mock ()
7676 runtime .get_flow .side_effect = FlowNotFoundError
7777 with pytest .raises (click .UsageError ):
78- run_click_command (flow .flow_info , runtime = runtime , flow_name = "test" )
78+ run_click_command (
79+ flow .flow_info , runtime = runtime , flow_name = "test" , extra_yaml = ()
80+ )
81+
82+
83+ def test_flow_info__extra_yaml_applied (tmp_path ):
84+ extra = tmp_path / "extra.yml"
85+ extra .write_text (
86+ "flows:\n "
87+ " injected_flow:\n "
88+ " description: injected flow\n "
89+ " steps:\n "
90+ " 1:\n "
91+ " task: util_sleep\n "
92+ )
93+ runtime = mock .Mock ()
94+ runtime .get_flow .return_value .get_summary .return_value = "summary text"
95+
96+ run_click_command (
97+ flow .flow_info ,
98+ runtime = runtime ,
99+ flow_name = "injected_flow" ,
100+ extra_yaml = (str (extra ),),
101+ )
102+
103+ runtime .reload_project_config .assert_called_once ()
104+ assert (
105+ "injected flow"
106+ in runtime .reload_project_config .call_args .kwargs ["additional_yaml" ]
107+ )
79108
80109
81110@mock .patch ("cumulusci.cli.flow.group_items" )
@@ -157,6 +186,7 @@ def test_flow_run():
157186 debug = False ,
158187 o = [("test_task__color" , "blue" )],
159188 no_prompt = True ,
189+ extra_yaml = (),
160190 )
161191
162192 runtime .get_flow .assert_called_once_with (
@@ -165,6 +195,55 @@ def test_flow_run():
165195 org_config .delete_org .assert_called_once ()
166196
167197
198+ def test_flow_run__extra_yaml_applied (tmp_path ):
199+ extra = tmp_path / "extra.yml"
200+ extra .write_text (
201+ "tasks:\n "
202+ " injected_task:\n "
203+ " description: injected via --extra-yaml\n "
204+ " class_path: cumulusci.tasks.util.Sleep\n "
205+ )
206+ runtime = mock .Mock ()
207+ runtime .get_org .return_value = ("dev" , mock .Mock (scratch = False ))
208+ runtime .get_flow .return_value .run .return_value = None
209+
210+ run_click_command (
211+ flow .flow_run ,
212+ runtime = runtime ,
213+ flow_name = "test_flow" ,
214+ org = "dev" ,
215+ delete_org = False ,
216+ debug = False ,
217+ o = (),
218+ no_prompt = True ,
219+ extra_yaml = (str (extra ),),
220+ )
221+
222+ runtime .reload_project_config .assert_called_once ()
223+ call_kwargs = runtime .reload_project_config .call_args .kwargs
224+ assert "injected via --extra-yaml" in call_kwargs ["additional_yaml" ]
225+
226+
227+ def test_flow_run__no_extra_yaml_does_not_reload ():
228+ runtime = mock .Mock ()
229+ runtime .get_org .return_value = ("dev" , mock .Mock (scratch = False ))
230+ runtime .get_flow .return_value .run .return_value = None
231+
232+ run_click_command (
233+ flow .flow_run ,
234+ runtime = runtime ,
235+ flow_name = "test_flow" ,
236+ org = "dev" ,
237+ delete_org = False ,
238+ debug = False ,
239+ o = (),
240+ no_prompt = True ,
241+ extra_yaml = (),
242+ )
243+
244+ runtime .reload_project_config .assert_called_once_with (additional_yaml = None )
245+
246+
168247def test_flow_run__delete_org_when_error_occurs_in_flow ():
169248 org_config = mock .Mock (scratch = True , config = {})
170249 runtime = CliRuntime (
@@ -194,6 +273,7 @@ def test_flow_run__delete_org_when_error_occurs_in_flow():
194273 debug = False ,
195274 o = [("test_task__color" , "blue" )],
196275 no_prompt = True ,
276+ extra_yaml = (),
197277 )
198278
199279 runtime .get_flow .assert_called_once_with (
@@ -217,6 +297,7 @@ def test_flow_run__option_error():
217297 debug = False ,
218298 o = [("test_task" , "blue" )],
219299 no_prompt = True ,
300+ extra_yaml = (),
220301 )
221302
222303
@@ -235,6 +316,7 @@ def test_flow_run__delete_non_scratch():
235316 debug = False ,
236317 o = None ,
237318 no_prompt = True ,
319+ extra_yaml = (),
238320 )
239321
240322
@@ -267,6 +349,7 @@ def test_flow_run__org_delete_error(echo):
267349 "debug" : False ,
268350 "no_prompt" : True ,
269351 "o" : (("test_task__color" , "blue" ),),
352+ "extra_yaml" : (),
270353 }
271354
272355 run_click_command (flow .flow_run , ** kwargs )
0 commit comments