add separate function for symlinks creation

This commit is contained in:
2026-01-19 13:21:28 +02:00
parent bb01f72931
commit 56d5478216
5 changed files with 35 additions and 6 deletions

View File

@ -30,6 +30,7 @@ from ahriman.core.utils import (
safe_filename,
srcinfo_property,
srcinfo_property_list,
symlink_relative,
trim_package,
utcnow,
walk,
@ -532,6 +533,23 @@ def test_srcinfo_property_list() -> None:
assert srcinfo_property_list("key", {"key_x86_64": ["overrides"]}, {}, architecture="x86_64") == ["overrides"]
def test_symlink_relative(mocker: MockerFixture) -> None:
"""
must create symlinks with relative paths
"""
symlink_mock = mocker.patch("pathlib.Path.symlink_to")
symlink_relative(Path("a"), Path("b"))
symlink_relative(Path("root/a"), Path("root/c"))
symlink_relative(Path("root/sub/a"), Path("root/c"))
symlink_mock.assert_has_calls([
MockCall(Path("b")),
MockCall(Path("c")),
MockCall(Path("../c")),
])
def test_trim_package() -> None:
"""
must trim package version