clan-cli/ssh: add tests + fixes
This commit is contained in:
@@ -36,7 +36,7 @@ def ssh(
|
||||
subprocess.run(cmd)
|
||||
|
||||
|
||||
def qrcode_scan(pictureFile: str) -> dict:
|
||||
def qrcode_scan(pictureFile: str) -> dict: # pragma: no cover
|
||||
subprocess.Popen(
|
||||
[
|
||||
"nix",
|
||||
@@ -52,7 +52,7 @@ def qrcode_scan(pictureFile: str) -> dict:
|
||||
).stdout.read()
|
||||
|
||||
|
||||
def main(args: argparse.Namespace) -> None:
|
||||
def main(args: argparse.Namespace) -> None: # pragma: no cover
|
||||
if args.json:
|
||||
with open(args.json) as file:
|
||||
ssh_data = json.load(file)
|
||||
@@ -62,13 +62,15 @@ def main(args: argparse.Namespace) -> None:
|
||||
ssh(host=ssh_data["address"], password=ssh_data["password"])
|
||||
|
||||
|
||||
|
||||
def register_parser(parser: argparse.ArgumentParser) -> None:
|
||||
parser.add_argument(
|
||||
group = parser.add_mutually_exclusive_group(required=True)
|
||||
group.add_argument(
|
||||
"-j",
|
||||
"--json",
|
||||
help="specify the json file for ssh data (generated by starting the clan installer)",
|
||||
)
|
||||
parser.add_argument(
|
||||
group.add_argument(
|
||||
"-P",
|
||||
"--png",
|
||||
help="specify the json file for ssh data as the qrcode image (generated by starting the clan installer)",
|
||||
|
||||
Reference in New Issue
Block a user