This commit is contained in:
2026-03-16 08:06:25 +02:00
parent 78d4064853
commit d0f8315cf1
35 changed files with 2493 additions and 624 deletions

View File

@@ -33,6 +33,20 @@ class TestParseProfile:
profile = parse_profile("test", raw)
assert len(profile.ssh_keys) == 1
def test_ssh_keygen_alias(self):
raw = {"ssh-keygen": [{"filename": "id_work", "type": "ed25519"}]}
profile = parse_profile("test", raw)
assert profile.ssh_keys[0]["path"] == "~/.ssh/id_work"
def test_requires_alias(self):
profile = parse_profile("test", {"requires": ["USER_EMAIL"]})
assert profile.env_required == ("USER_EMAIL",)
def test_post_link_and_dotfiles_profile(self):
profile = parse_profile("test", {"dotfiles-profile": "linux-work", "post-link": "echo done"})
assert profile.dotfiles_profile == "linux-work"
assert profile.post_link == "echo done"
class TestPlanBootstrap:
def test_basic_plan(self):
@@ -73,6 +87,16 @@ class TestPlanBootstrap:
runcmd_actions = [a for a in plan.actions if "custom command" in a.description.lower()]
assert len(runcmd_actions) == 1
def test_post_link_produces_action(self):
profile = Profile(
name="test", os="linux", arch=None,
hostname=None, locale=None, shell=None,
ssh_keys=[], runcmd=[], packages=[], env_required=[],
post_link="echo done",
)
plan = plan_bootstrap(profile, {})
assert any(action.phase == "post-link" for action in plan.actions)
def test_ssh_keys_action(self):
profile = Profile(
name="test", os="linux", arch=None,