add archive trigger

This commit is contained in:
2025-08-14 13:32:55 +03:00
parent c89f6ad98c
commit 887b2b21b0
9 changed files with 173 additions and 17 deletions

View File

@ -58,7 +58,7 @@ def test_repo_init(repo: Repo, mocker: MockerFixture) -> None:
def test_repo_remove(repo: Repo, mocker: MockerFixture) -> None:
"""
must call repo-remove on package addition
must call repo-remove on package removal
"""
mocker.patch("pathlib.Path.glob", return_value=[])
check_output_mock = mocker.patch("ahriman.core.alpm.repo.check_output")
@ -66,11 +66,25 @@ def test_repo_remove(repo: Repo, mocker: MockerFixture) -> None:
repo.remove("package", Path("package.pkg.tar.xz"))
check_output_mock.assert_called_once() # it will be checked later
assert check_output_mock.call_args[0][0] == "repo-remove"
assert "package" in check_output_mock.call_args[0]
def test_repo_remove_guess_package(repo: Repo, mocker: MockerFixture) -> None:
"""
must call repo-remove on package removal if no package name set
"""
mocker.patch("pathlib.Path.glob", return_value=[])
check_output_mock = mocker.patch("ahriman.core.alpm.repo.check_output")
repo.remove(None, Path("package.pkg.tar.xz"))
check_output_mock.assert_called_once() # it will be checked later
assert check_output_mock.call_args[0][0] == "repo-remove"
assert "package" in check_output_mock.call_args[0]
def test_repo_remove_fail_no_file(repo: Repo, mocker: MockerFixture) -> None:
"""
must fail on missing file
must fail removal on missing file
"""
mocker.patch("pathlib.Path.glob", return_value=[Path("package.pkg.tar.xz")])
mocker.patch("pathlib.Path.unlink", side_effect=FileNotFoundError)