From e08c0b338dc26ba234a6ae8cd1bfced7dd96be16 Mon Sep 17 00:00:00 2001 From: DavHau Date: Fri, 22 Sep 2023 19:17:45 +0200 Subject: [PATCH] test_basics: add cli fixture --- pkgs/clan-cli/tests/end_to_end/test_basics.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pkgs/clan-cli/tests/end_to_end/test_basics.py b/pkgs/clan-cli/tests/end_to_end/test_basics.py index f00fe07..5bb3dce 100644 --- a/pkgs/clan-cli/tests/end_to_end/test_basics.py +++ b/pkgs/clan-cli/tests/end_to_end/test_basics.py @@ -6,12 +6,19 @@ import pytest from cli import Cli +@pytest.fixture +def cli() -> Cli: + return Cli() + + @pytest.mark.impure -def test_basics( - monkeypatch: pytest.MonkeyPatch, temporary_dir: Path, capsys: pytest.CaptureFixture +def test_all( + monkeypatch: pytest.MonkeyPatch, + temporary_dir: Path, + capsys: pytest.CaptureFixture, + cli: Cli, ) -> None: monkeypatch.chdir(temporary_dir) - cli = Cli() cli.run(["create"]) assert (temporary_dir / ".clan-flake").exists() cli.run(["machines", "create", "machine1"]) @@ -29,3 +36,8 @@ def test_basics( flake_outputs["nixosConfigurations"]["machine1"] except KeyError: pytest.fail("nixosConfigurations.machine1 not found in flake outputs") + # configure machine1 + capsys.readouterr() + cli.run(["config", "--machine", "machine1", "services.openssh.enable"]) + capsys.readouterr() + cli.run(["config", "--machine", "machine1", "services.openssh.enable", "true"])