mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-14 22:45:47 +00:00
add docstrings for every fixture and test methods
also add tests for missing components
This commit is contained in:
@ -12,11 +12,19 @@ from ahriman.models.package_description import PackageDescription
|
||||
|
||||
@pytest.fixture
|
||||
def build_status_failed() -> BuildStatus:
|
||||
"""
|
||||
build result fixture with failed status
|
||||
:return: failed build status test instance
|
||||
"""
|
||||
return BuildStatus(BuildStatusEnum.Failed, 42)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def counters() -> Counters:
|
||||
"""
|
||||
counters fixture
|
||||
:return: counters test instance
|
||||
"""
|
||||
return Counters(total=10,
|
||||
unknown=1,
|
||||
pending=2,
|
||||
@ -27,6 +35,11 @@ def counters() -> Counters:
|
||||
|
||||
@pytest.fixture
|
||||
def internal_status(counters: Counters) -> InternalStatus:
|
||||
"""
|
||||
internal status fixture
|
||||
:param counters: counters fixture
|
||||
:return: internal status test instance
|
||||
"""
|
||||
return InternalStatus(architecture="x86_64",
|
||||
packages=counters,
|
||||
version=version.__version__,
|
||||
@ -35,6 +48,10 @@ def internal_status(counters: Counters) -> InternalStatus:
|
||||
|
||||
@pytest.fixture
|
||||
def package_tpacpi_bat_git() -> Package:
|
||||
"""
|
||||
git package fixture
|
||||
:return: git package test instance
|
||||
"""
|
||||
return Package(
|
||||
base="tpacpi-bat-git",
|
||||
version="3.1.r12.g4959b52-1",
|
||||
@ -44,6 +61,11 @@ def package_tpacpi_bat_git() -> Package:
|
||||
|
||||
@pytest.fixture
|
||||
def pyalpm_handle(pyalpm_package_ahriman: MagicMock) -> MagicMock:
|
||||
"""
|
||||
mock object for pyalpm
|
||||
:param pyalpm_package_ahriman: mock object for pyalpm package
|
||||
:return: pyalpm mock
|
||||
"""
|
||||
mock = MagicMock()
|
||||
mock.handle.load_pkg.return_value = pyalpm_package_ahriman
|
||||
return mock
|
||||
@ -51,6 +73,11 @@ def pyalpm_handle(pyalpm_package_ahriman: MagicMock) -> MagicMock:
|
||||
|
||||
@pytest.fixture
|
||||
def pyalpm_package_ahriman(package_ahriman: Package) -> MagicMock:
|
||||
"""
|
||||
mock object for pyalpm package
|
||||
:param package_ahriman: package fixture
|
||||
:return: pyalpm package mock
|
||||
"""
|
||||
mock = MagicMock()
|
||||
type(mock).base = PropertyMock(return_value=package_ahriman.base)
|
||||
type(mock).name = PropertyMock(return_value=package_ahriman.base)
|
||||
@ -60,6 +87,11 @@ def pyalpm_package_ahriman(package_ahriman: Package) -> MagicMock:
|
||||
|
||||
@pytest.fixture
|
||||
def pyalpm_package_description_ahriman(package_description_ahriman: PackageDescription) -> MagicMock:
|
||||
"""
|
||||
mock object for pyalpm package description
|
||||
:param package_description_ahriman: package description fixture
|
||||
:return: pyalpm package description mock
|
||||
"""
|
||||
mock = MagicMock()
|
||||
type(mock).arch = PropertyMock(return_value=package_description_ahriman.architecture)
|
||||
type(mock).builddate = PropertyMock(return_value=package_description_ahriman.build_date)
|
||||
|
Reference in New Issue
Block a user