11from functools import partial
2+ from itertools import count
23from pathlib import Path
34from unittest .mock import call , patch
45
@@ -12,25 +13,27 @@ def obs_install_action(action_cls, args_mock, tmp_data_folder, start_cmd_mock):
1213 action = ObsInstallAction ()
1314 args_mock .prod = "obs"
1415 args_mock .action = "install"
15- with patch .object (action , "execute" , new = partial (action .execute , args_mock )):
16+ with (
17+ patch .object (action , "execute" , new = partial (action .execute , args_mock )),
18+ patch ("platform.system" , return_value = "Linux" ),
19+ ):
1620 yield action
1721
1822
1923@pytest .mark .integration
2024def test_obs_install (obs_install_action , start_cmd_mock , tmp_data_folder , stdout_mock ):
21- stdout_mock .side_effect = (
22- [b"{}" ],
23- [],
24- [],
25- [],
26- [],
27- [],
28- [],
29- [b'{"service_account_key": "demo-account-key", "project_id": "test-project-id"}' ],
30- [],
31- [],
32- )
25+ def _stdout_side_effect ():
26+ for idx in count ():
27+ if idx == 0 :
28+ yield [b"{}" ]
29+ elif idx == 7 :
30+ yield [b'[{"Name": "observability-ui", "URLs": ["http://localhost:8501"]}]' ]
31+ elif idx == 8 :
32+ yield [b'{"service_account_key": "demo-account-key", "project_id": "test-project-id"}' ]
33+ else :
34+ yield []
3335
36+ stdout_mock .side_effect = iter (_stdout_side_effect ())
3437 obs_install_action .execute ()
3538
3639 def_call = partial (call , raise_on_non_zero = True , env = None )
0 commit comments