test_update_cli: also test --help

This commit is contained in:
Jörg Thalheim
2023-08-11 17:11:47 +02:00
parent 2ff7820887
commit 51f40a4f09
2 changed files with 10 additions and 2 deletions

View File

@@ -94,7 +94,6 @@ def update(args: argparse.Namespace) -> None:
def register_parser(parser: argparse.ArgumentParser) -> None: def register_parser(parser: argparse.ArgumentParser) -> None:
parser.add_mutually_exclusive_group(required=True)
# TODO pass all args we don't parse into ssh_args, currently it fails if arg starts with - # TODO pass all args we don't parse into ssh_args, currently it fails if arg starts with -
parser.add_argument("--flake-uri", type=str, default=".#", help="nix flake uri") parser.add_argument("--flake-uri", type=str, default=".#", help="nix flake uri")
parser.add_argument( parser.add_argument(

View File

@@ -1,12 +1,21 @@
import argparse
import os import os
import shutil import shutil
from pathlib import Path from pathlib import Path
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
import pytest
from environment import mock_env from environment import mock_env
from host_group import HostGroup from host_group import HostGroup
from clan_cli.update import deploy_nixos from clan_cli.update import deploy_nixos, register_parser
def test_cli() -> None:
parser = argparse.ArgumentParser()
register_parser(parser)
with pytest.raises(SystemExit):
parser.parse_args(["--help"])
def test_update(clan_flake: Path, host_group: HostGroup) -> None: def test_update(clan_flake: Path, host_group: HostGroup) -> None: