clan_lib: Add test for check_valid_clan function
This commit is contained in:
@@ -71,8 +71,8 @@ def substitute(
|
|||||||
|
|
||||||
with file.open() as f:
|
with file.open() as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
if clan_core_replacement:
|
|
||||||
line = line.replace("__NIXPKGS__", str(nixpkgs_source()))
|
line = line.replace("__NIXPKGS__", str(nixpkgs_source()))
|
||||||
|
if clan_core_replacement:
|
||||||
line = line.replace("__CLAN_CORE__", clan_core_replacement)
|
line = line.replace("__CLAN_CORE__", clan_core_replacement)
|
||||||
line = line.replace(
|
line = line.replace(
|
||||||
"git+https://git.clan.lol/clan/clan-core", clan_core_replacement
|
"git+https://git.clan.lol/clan/clan-core", clan_core_replacement
|
||||||
@@ -385,6 +385,7 @@ def test_flake(
|
|||||||
flake_template="test_flake",
|
flake_template="test_flake",
|
||||||
monkeypatch=monkeypatch,
|
monkeypatch=monkeypatch,
|
||||||
)
|
)
|
||||||
|
|
||||||
# check that git diff on ./sops is empty
|
# check that git diff on ./sops is empty
|
||||||
if (temporary_home / "test_flake" / "sops").exists():
|
if (temporary_home / "test_flake" / "sops").exists():
|
||||||
git_proc = sp.run(
|
git_proc = sp.run(
|
||||||
|
|||||||
22
pkgs/clan-cli/clan_lib/clan/check_test.py
Normal file
22
pkgs/clan-cli/clan_lib/clan/check_test.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from clan_cli.tests.fixtures_flakes import FlakeForTest
|
||||||
|
|
||||||
|
from clan_lib.clan.check import check_clan_valid
|
||||||
|
from clan_lib.flake import Flake
|
||||||
|
|
||||||
|
|
||||||
|
def test_check_clan_valid(
|
||||||
|
temporary_home: Path, test_flake_with_core: FlakeForTest, test_flake: FlakeForTest
|
||||||
|
) -> None:
|
||||||
|
# Test with a valid clan
|
||||||
|
flake = Flake(str(test_flake_with_core.path))
|
||||||
|
assert check_clan_valid(flake) is True
|
||||||
|
|
||||||
|
# Test with an invalid clan
|
||||||
|
flake = Flake(str(test_flake.path))
|
||||||
|
assert check_clan_valid(flake) is False
|
||||||
|
|
||||||
|
# Test with a non-existent clan
|
||||||
|
flake = Flake(str(temporary_home))
|
||||||
|
assert check_clan_valid(flake) is False
|
||||||
Reference in New Issue
Block a user