clan-core: add clan meta for ui usage

This commit is contained in:
Johannes Kirschbauer
2024-05-31 17:22:38 +02:00
committed by hsjobeki
parent 2ac4294ff9
commit c7008fd302
9 changed files with 167 additions and 19 deletions

View File

@@ -47,3 +47,33 @@ def test_create_flake(
flake_outputs["nixosConfigurations"]["machine1"]
except KeyError:
pytest.fail("nixosConfigurations.machine1 not found in flake outputs")
@pytest.mark.impure
def test_ui_template(
monkeypatch: pytest.MonkeyPatch,
capsys: pytest.CaptureFixture,
temporary_home: Path,
cli: Cli,
) -> None:
flake_dir = temporary_home / "test-flake"
url = "git+https://git.clan.lol/clan/clan-core#empty"
cli.run(["flakes", "create", str(flake_dir), "--url", url])
assert (flake_dir / ".clan-flake").exists()
monkeypatch.chdir(flake_dir)
cli.run(["machines", "create", "machine1"])
capsys.readouterr() # flush cache
cli.run(["machines", "list"])
assert "machine1" in capsys.readouterr().out
flake_show = subprocess.run(
["nix", "flake", "show", "--json"],
check=True,
capture_output=True,
text=True,
)
flake_outputs = json.loads(flake_show.stdout)
try:
flake_outputs["nixosConfigurations"]["machine1"]
except KeyError:
pytest.fail("nixosConfigurations.machine1 not found in flake outputs")