From 59393bb35e8621762cd3def2b03a025affeb14d3 Mon Sep 17 00:00:00 2001 From: Qubasa Date: Fri, 20 Oct 2023 01:20:40 +0200 Subject: [PATCH] Working test_create_flake --- pkgs/clan-cli/clan_cli/config/__init__.py | 11 +++++------ pkgs/clan-cli/tests/fixtures_flakes.py | 4 ++-- pkgs/clan-cli/tests/test_create_flake.py | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/pkgs/clan-cli/clan_cli/config/__init__.py b/pkgs/clan-cli/clan_cli/config/__init__.py index dcf2d8eb..4477803e 100644 --- a/pkgs/clan-cli/clan_cli/config/__init__.py +++ b/pkgs/clan-cli/clan_cli/config/__init__.py @@ -306,11 +306,6 @@ def register_parser( # inject callback function to process the input later parser.set_defaults(func=get_or_set_option) - parser.add_argument( - "flake", - type=str, - help="name of the flake to set machine options for", - ) parser.add_argument( "--machine", "-m", @@ -354,7 +349,11 @@ def register_parser( nargs="*", help="option value to set (if omitted, the current value is printed)", ) - + parser.add_argument( + "flake", + type=str, + help="name of the flake to set machine options for", + ) def main(argv: Optional[list[str]] = None) -> None: if argv is None: diff --git a/pkgs/clan-cli/tests/fixtures_flakes.py b/pkgs/clan-cli/tests/fixtures_flakes.py index 896c173d..ff716c9c 100644 --- a/pkgs/clan-cli/tests/fixtures_flakes.py +++ b/pkgs/clan-cli/tests/fixtures_flakes.py @@ -80,9 +80,9 @@ def create_flake( @pytest.fixture def test_flake( - monkeypatch: pytest.MonkeyPatch, temporary_dir: Path + monkeypatch: pytest.MonkeyPatch, temporary_home: Path ) -> Iterator[FlakeForTest]: - yield from create_flake(monkeypatch, temporary_dir, FlakeName("test_flake")) + yield from create_flake(monkeypatch, temporary_home, FlakeName("test_flake")) @pytest.fixture diff --git a/pkgs/clan-cli/tests/test_create_flake.py b/pkgs/clan-cli/tests/test_create_flake.py index d379a402..571bf73d 100644 --- a/pkgs/clan-cli/tests/test_create_flake.py +++ b/pkgs/clan-cli/tests/test_create_flake.py @@ -65,6 +65,6 @@ def test_create_flake( pytest.fail("nixosConfigurations.machine1 not found in flake outputs") # configure machine1 capsys.readouterr() - cli.run(["config", "--machine", "machine1", "services.openssh.enable"]) + cli.run(["config", "--machine", "machine1", "services.openssh.enable", "", flake_name]) capsys.readouterr() - cli.run(["config", "--machine", "machine1", "services.openssh.enable", "true"]) + cli.run(["config", "--machine", "machine1", "services.openssh.enable", "true", flake_name])