test_basics: add cli fixture
This commit is contained in:
@@ -6,12 +6,19 @@ import pytest
|
|||||||
from cli import Cli
|
from cli import Cli
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def cli() -> Cli:
|
||||||
|
return Cli()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.impure
|
@pytest.mark.impure
|
||||||
def test_basics(
|
def test_all(
|
||||||
monkeypatch: pytest.MonkeyPatch, temporary_dir: Path, capsys: pytest.CaptureFixture
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
|
temporary_dir: Path,
|
||||||
|
capsys: pytest.CaptureFixture,
|
||||||
|
cli: Cli,
|
||||||
) -> None:
|
) -> None:
|
||||||
monkeypatch.chdir(temporary_dir)
|
monkeypatch.chdir(temporary_dir)
|
||||||
cli = Cli()
|
|
||||||
cli.run(["create"])
|
cli.run(["create"])
|
||||||
assert (temporary_dir / ".clan-flake").exists()
|
assert (temporary_dir / ".clan-flake").exists()
|
||||||
cli.run(["machines", "create", "machine1"])
|
cli.run(["machines", "create", "machine1"])
|
||||||
@@ -29,3 +36,8 @@ def test_basics(
|
|||||||
flake_outputs["nixosConfigurations"]["machine1"]
|
flake_outputs["nixosConfigurations"]["machine1"]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pytest.fail("nixosConfigurations.machine1 not found in flake outputs")
|
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"])
|
||||||
|
|||||||
Reference in New Issue
Block a user