implement single-function patches (#69)

This commit is contained in:
2022-10-30 03:11:03 +03:00
committed by GitHub
parent ad7cdb7d95
commit 649df81aa5
25 changed files with 632 additions and 163 deletions

View File

@ -1,10 +1,11 @@
import pytest
from ahriman.core.formatters import AurPrinter, ConfigurationPrinter, PackagePrinter, StatusPrinter, StringPrinter, \
UpdatePrinter, UserPrinter, VersionPrinter
from ahriman.core.formatters import AurPrinter, ConfigurationPrinter, PackagePrinter, PatchPrinter, StatusPrinter, \
StringPrinter, UpdatePrinter, UserPrinter, VersionPrinter
from ahriman.models.aur_package import AURPackage
from ahriman.models.build_status import BuildStatus
from ahriman.models.package import Package
from ahriman.models.pkgbuild_patch import PkgbuildPatch
from ahriman.models.user import User
@ -47,6 +48,20 @@ def package_ahriman_printer(package_ahriman: Package) -> PackagePrinter:
return PackagePrinter(package_ahriman, BuildStatus())
@pytest.fixture
def patch_printer(package_ahriman: Package) -> PatchPrinter:
"""
fixture for patch printer
Args:
package_ahriman(Package): package fixture
Returns:
PatchPrinter: patch printer test instance
"""
return PatchPrinter(package_ahriman.base, [PkgbuildPatch("key", "value")])
@pytest.fixture
def status_printer() -> StatusPrinter:
"""

View File

@ -0,0 +1,22 @@
from ahriman.core.formatters import PatchPrinter
def test_properties(patch_printer: PatchPrinter) -> None:
"""
must return non empty properties list
"""
assert patch_printer.properties()
def test_properties_required(patch_printer: PatchPrinter) -> None:
"""
must return all properties as required
"""
assert all(prop.is_required for prop in patch_printer.properties())
def test_title(patch_printer: PatchPrinter) -> None:
"""
must return non empty title
"""
assert patch_printer.title() == "ahriman"