mirror of
https://github.com/arcan1s/ahriman.git
synced 2026-01-18 04:03:42 +00:00
add archive trigger
This commit is contained in:
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user