feat(spec-05-auth-fallback-chain): worker (eng_flash_high) implementation
This commit is contained in:
1 parent
89ca1ec621
commit
59640d20a4
2 files changed
+33
-1
No files matched your search
+18
-1
@@ -248,9 +248,26 @@ def _build_tree(nodes, folders, profiles, plugins, configdir):
|
|||||||
"--fzf-wrapper": ["bash", "zsh"],
|
"--fzf-wrapper": ["bash", "zsh"],
|
||||||
"--service-mode": ["local", "remote"],
|
"--service-mode": ["local", "remote"],
|
||||||
"--sync-remote": ["true", "false"],
|
"--sync-remote": ["true", "false"],
|
||||||
|
"--disable-fallback-on-insecure-hostkey": ["true", "false"],
|
||||||
"--help": None, "-h": None,
|
"--help": None, "-h": None,
|
||||||
}
|
}
|
||||||
for opt in ["--keepalive", "--engineer-model", "--engineer-api-key", "--architect-model", "--architect-api-key", "--theme", "--remote", "--trusted-commands", "--shell-command", "--shell-prompt", "--shell-os"]:
|
for opt in [
|
||||||
|
"--keepalive",
|
||||||
|
"--engineer-model",
|
||||||
|
"--engineer-api-key",
|
||||||
|
"--architect-model",
|
||||||
|
"--architect-api-key",
|
||||||
|
"--theme",
|
||||||
|
"--remote",
|
||||||
|
"--trusted-commands",
|
||||||
|
"--shell-command",
|
||||||
|
"--shell-prompt",
|
||||||
|
"--shell-os",
|
||||||
|
"--max-auth-prompts",
|
||||||
|
"--max-total-auth-attempts",
|
||||||
|
"--max-hop-host-attempts",
|
||||||
|
"--max-global-user-attempts",
|
||||||
|
]:
|
||||||
config_dict[opt] = {"*": config_dict}
|
config_dict[opt] = {"*": config_dict}
|
||||||
config_dict["--configfolder"] = {"__extra__": lambda w: get_cwd(w, "--configfolder", True), "*": config_dict}
|
config_dict["--configfolder"] = {"__extra__": lambda w: get_cwd(w, "--configfolder", True), "*": config_dict}
|
||||||
config_dict["--engineer-auth"] = {"__extra__": lambda w: get_cwd(w, "--engineer-auth"), "*": config_dict}
|
config_dict["--engineer-auth"] = {"__extra__": lambda w: get_cwd(w, "--engineer-auth"), "*": config_dict}
|
||||||
|
|||||||
@@ -80,11 +80,22 @@ class TestTreeCompletions:
|
|||||||
assert "--shell-command" in config_completions
|
assert "--shell-command" in config_completions
|
||||||
assert "--shell-prompt" in config_completions
|
assert "--shell-prompt" in config_completions
|
||||||
assert "--shell-os" in config_completions
|
assert "--shell-os" in config_completions
|
||||||
|
assert "--max-auth-prompts" in config_completions
|
||||||
|
assert "--max-total-auth-attempts" in config_completions
|
||||||
|
assert "--max-hop-host-attempts" in config_completions
|
||||||
|
assert "--max-global-user-attempts" in config_completions
|
||||||
|
assert "--disable-fallback-on-insecure-hostkey" in config_completions
|
||||||
|
|
||||||
# Resolve when --engineer-auth is chosen in config
|
# Resolve when --engineer-auth is chosen in config
|
||||||
auth_comp = resolve_completion(["config", "--engineer-auth", ""], tree)
|
auth_comp = resolve_completion(["config", "--engineer-auth", ""], tree)
|
||||||
assert isinstance(auth_comp, list)
|
assert isinstance(auth_comp, list)
|
||||||
|
|
||||||
|
# Resolve boolean values for --disable-fallback-on-insecure-hostkey
|
||||||
|
assert resolve_completion(
|
||||||
|
["config", "--disable-fallback-on-insecure-hostkey", ""],
|
||||||
|
tree,
|
||||||
|
) == ["true", "false"]
|
||||||
|
|
||||||
# Loop back check:
|
# Loop back check:
|
||||||
# e.g., connpy config --engineer-auth some_val
|
# e.g., connpy config --engineer-auth some_val
|
||||||
# should loop back and resolve to config options
|
# should loop back and resolve to config options
|
||||||
@@ -93,6 +104,10 @@ class TestTreeCompletions:
|
|||||||
assert "--engineer-auth" in loop_back_comp
|
assert "--engineer-auth" in loop_back_comp
|
||||||
assert "--shell-command" in loop_back_comp
|
assert "--shell-command" in loop_back_comp
|
||||||
|
|
||||||
|
auth_budget_loop_back = resolve_completion(["config", "--max-auth-prompts", "3", ""], tree)
|
||||||
|
assert "--max-total-auth-attempts" in auth_budget_loop_back
|
||||||
|
assert "--disable-fallback-on-insecure-hostkey" in auth_budget_loop_back
|
||||||
|
|
||||||
def test_shell_completions(self):
|
def test_shell_completions(self):
|
||||||
from connpy.completion import _build_tree, resolve_completion
|
from connpy.completion import _build_tree, resolve_completion
|
||||||
tree = _build_tree([], [], [], {}, "/tmp")
|
tree = _build_tree([], [], [], {}, "/tmp")
|
||||||
|
|||||||
Reference in new issue
Block a user