def test_default_cli_flags(config_dir, config_file, cli_script_name): config = {"conf_file": config_file, "id": "the-id"} expected = [ sys.executable, cli_script_name, "--config-dir={}".format(config_dir.strpath), "--log-level=quiet", ] proc = SaltDaemonFactory(start_timeout=1, cli_script_name=cli_script_name, config=config) cmdline = proc.build_cmdline() assert cmdline == expected
def test_override_config_dir(config_dir, config_file, cli_script_name, flag): passed_config_dir = config_dir.strpath + ".new" if flag is None: args = ["--config-dir={}".format(config_dir.strpath)] elif flag.endswith("="): args = [flag + passed_config_dir] else: args = [flag, passed_config_dir] default_timeout = 10 config = {"conf_file": config_file, "id": "the-id"} expected = [sys.executable, cli_script_name, "--log-level=quiet"] + args proc = SaltDaemonFactory(start_timeout=1, cli_script_name=cli_script_name, config=config) cmdline = proc.build_cmdline(*args) assert cmdline == expected
def test_override_log_level(config_dir, config_file, cli_script_name, flag): config = {"conf_file": config_file, "id": "the-id"} if flag.endswith("="): args = [flag + "info"] else: args = [flag, "info"] expected = [ sys.executable, cli_script_name, "--config-dir={}".format(config_dir.strpath), ] + args proc = SaltDaemonFactory(start_timeout=1, cli_script_name=cli_script_name, config=config) cmdline = proc.build_cmdline(*args) assert cmdline == expected