Unit tests: fix template test - override the input in the flake template
This commit is contained in:
@@ -32,6 +32,10 @@ def substitute(
|
||||
line = line.replace(
|
||||
"git+https://git.clan.lol/clan/clan-core", str(clan_core_flake)
|
||||
)
|
||||
line = line.replace(
|
||||
"https://git.clan.lol/clan/clan-core/archive/main.tar.gz",
|
||||
str(clan_core_flake),
|
||||
)
|
||||
line = line.replace("__CLAN_SOPS_KEY_PATH__", sops_key)
|
||||
line = line.replace("__CLAN_SOPS_KEY_DIR__", str(flake))
|
||||
print(line, end="")
|
||||
|
||||
@@ -3,6 +3,7 @@ import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from fixtures_flakes import substitute
|
||||
from helpers import cli
|
||||
|
||||
|
||||
@@ -17,7 +18,15 @@ def test_create_flake(
|
||||
|
||||
url = f"{clan_core}#default"
|
||||
cli.run(["flakes", "create", str(flake_dir), f"--url={url}"])
|
||||
|
||||
assert (flake_dir / ".clan-flake").exists()
|
||||
|
||||
# Replace the inputs.clan.url in the template flake.nix
|
||||
substitute(
|
||||
flake_dir / "flake.nix",
|
||||
clan_core,
|
||||
)
|
||||
|
||||
monkeypatch.chdir(flake_dir)
|
||||
cli.run(["machines", "create", "machine1"])
|
||||
capsys.readouterr() # flush cache
|
||||
@@ -55,6 +64,13 @@ def test_ui_template(
|
||||
flake_dir = temporary_home / "test-flake"
|
||||
url = f"{clan_core}#minimal"
|
||||
cli.run(["flakes", "create", str(flake_dir), f"--url={url}"])
|
||||
|
||||
# Replace the inputs.clan.url in the template flake.nix
|
||||
substitute(
|
||||
flake_dir / "flake.nix",
|
||||
clan_core,
|
||||
)
|
||||
|
||||
monkeypatch.chdir(flake_dir)
|
||||
cli.run(["machines", "create", "machine1"])
|
||||
capsys.readouterr() # flush cache
|
||||
|
||||
Reference in New Issue
Block a user