mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-10-27 20:03:42 +00:00
implement single-function patches (#69)
This commit is contained in:
@ -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:
|
||||
"""
|
||||
|
||||
22
tests/ahriman/core/formatters/test_patch_printer.py
Normal file
22
tests/ahriman/core/formatters/test_patch_printer.py
Normal 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"
|
||||
Reference in New Issue
Block a user