mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-15 23:09:56 +00:00
consider vcs flag and vcs_allowed_age during local packages update
This commit is contained in:
@ -6,6 +6,7 @@ from unittest.mock import MagicMock
|
||||
|
||||
from ahriman.core.alpm.pacman import Pacman
|
||||
from ahriman.core.exceptions import PackageInfoError
|
||||
from ahriman.core.util import utcnow
|
||||
from ahriman.models.aur_package import AURPackage
|
||||
from ahriman.models.package import Package
|
||||
from ahriman.models.repository_paths import RepositoryPaths
|
||||
@ -285,21 +286,46 @@ def test_is_newer_than(package_ahriman: Package, package_python_schedule: Packag
|
||||
assert not package_python_schedule.is_newer_than(min_date)
|
||||
|
||||
|
||||
def test_is_outdated_false(package_ahriman: Package, repository_paths: RepositoryPaths) -> None:
|
||||
def test_is_outdated_false(package_ahriman: Package, repository_paths: RepositoryPaths, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must be not outdated for the same package
|
||||
"""
|
||||
assert not package_ahriman.is_outdated(package_ahriman, repository_paths, calculate_version=True)
|
||||
actual_version_mock = mocker.patch("ahriman.models.package.Package.actual_version",
|
||||
return_value=package_ahriman.version)
|
||||
assert not package_ahriman.is_outdated(package_ahriman, repository_paths)
|
||||
actual_version_mock.assert_called_once_with(repository_paths)
|
||||
|
||||
|
||||
def test_is_outdated_true(package_ahriman: Package, repository_paths: RepositoryPaths) -> None:
|
||||
def test_is_outdated_true(package_ahriman: Package, repository_paths: RepositoryPaths, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must be outdated for the new version
|
||||
"""
|
||||
other = Package.from_json(package_ahriman.view())
|
||||
other.version = other.version.replace("-1", "-2")
|
||||
actual_version_mock = mocker.patch("ahriman.models.package.Package.actual_version", return_value=other.version)
|
||||
|
||||
assert package_ahriman.is_outdated(other, repository_paths, calculate_version=True)
|
||||
assert package_ahriman.is_outdated(other, repository_paths)
|
||||
actual_version_mock.assert_called_once_with(repository_paths)
|
||||
|
||||
|
||||
def test_is_outdated_no_version_calculation(package_ahriman: Package, repository_paths: RepositoryPaths,
|
||||
mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must not call actual version if calculation is disabled
|
||||
"""
|
||||
actual_version_mock = mocker.patch("ahriman.models.package.Package.actual_version")
|
||||
assert not package_ahriman.is_outdated(package_ahriman, repository_paths, calculate_version=False)
|
||||
actual_version_mock.assert_not_called()
|
||||
|
||||
|
||||
def test_is_outdated_fresh_package(package_ahriman: Package, repository_paths: RepositoryPaths,
|
||||
mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must not call actual version if package is never than specified time
|
||||
"""
|
||||
actual_version_mock = mocker.patch("ahriman.models.package.Package.actual_version")
|
||||
assert not package_ahriman.is_outdated(package_ahriman, repository_paths, vcs_allowed_age=utcnow().timestamp())
|
||||
actual_version_mock.assert_not_called()
|
||||
|
||||
|
||||
def test_build_status_pretty_print(package_ahriman: Package) -> None:
|
||||
|
Reference in New Issue
Block a user