from pam_deploy_graph.script_runner import ScriptActionRunner def test_build_shell_action_command(): runner = ScriptActionRunner() command = runner.build_command( "publish-version", script_entry="deploy.sh", config_path="./config.txt", hash_code="abc", trace_file_path="./logs/trace.log", ) assert command == [ "bash", "./deploy.sh", "--config", "./config.txt", "--action", "publish-version", "--hash-code", "abc", "--trace-file", "./logs/trace.log", ] def test_build_powershell_action_command(): runner = ScriptActionRunner() command = runner.build_command( "rollback-ip", script_entry="deploy.ps1", config_path=".\\config.txt", ip="192.168.1.10", stop_first=True, ) assert command == [ "powershell", "-File", ".\\deploy.ps1", "-ConfigPath", ".\\config.txt", "-Action", "rollback-ip", "-Ip", "192.168.1.10", "-RollbackStopFirst", ]