mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-23 18:59:56 +00:00
feat: add __call__ method to printers
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import pytest
|
||||
|
||||
from pytest_mock import MockerFixture
|
||||
from unittest.mock import MagicMock, call as MockCall
|
||||
|
||||
@ -63,3 +65,12 @@ def test_title() -> None:
|
||||
must return empty title
|
||||
"""
|
||||
assert Printer().title() is None
|
||||
|
||||
|
||||
def test_call(mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must perform print call
|
||||
"""
|
||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||
Printer()(verbose=False)
|
||||
print_mock.assert_called_once_with(verbose=False, log_fn=pytest.helpers.anyvar(int), separator=": ")
|
||||
|
@ -1,3 +1,5 @@
|
||||
import pytest
|
||||
|
||||
from pytest_mock import MockerFixture
|
||||
from unittest.mock import call as MockCall
|
||||
|
||||
@ -18,4 +20,7 @@ def test_generate(configuration: Configuration, result: Result, package_python_s
|
||||
report = Console(repository_id, configuration, "console")
|
||||
|
||||
report.generate([], result)
|
||||
print_mock.assert_has_calls([MockCall(verbose=True), MockCall(verbose=True)])
|
||||
print_mock.assert_has_calls([
|
||||
MockCall(verbose=True, log_fn=pytest.helpers.anyvar(int), separator=": "),
|
||||
MockCall(verbose=True, log_fn=pytest.helpers.anyvar(int), separator=": "),
|
||||
])
|
||||
|
Reference in New Issue
Block a user