Files
ahriman/tests/ahriman/application/formatters/test_printer.py
Evgeniy Alekseev 09b0f2914d Add ability to show more info in search and status subcommands
This feature also introduces the followiing changes
* aur-search command now works as expected with multiterms
* printer classes for managing of data print
* --sort-by argument for aur-search subcommand instead of using package
  name
* --quiet argument now has also --no-quite option
* if --quite is supplied, the log level will be set to warn instead of
  critical to be able to see error messages
* pretty_datetime function now also supports datetime objects
* BuildStatus is now pure dataclass
2021-10-26 04:27:36 +03:00

46 lines
1.1 KiB
Python

from unittest.mock import MagicMock
from ahriman.application.formatters.package_printer import PackagePrinter
from ahriman.application.formatters.printer import Printer
def test_print(package_ahriman_printer: PackagePrinter) -> None:
"""
must print content
"""
log_mock = MagicMock()
package_ahriman_printer.print(verbose=False, log_fn=log_mock)
log_mock.assert_called()
def test_print_empty() -> None:
"""
must not print empty object
"""
log_mock = MagicMock()
Printer().print(verbose=True, log_fn=log_mock)
log_mock.assert_not_called()
def test_print_verbose(package_ahriman_printer: PackagePrinter) -> None:
"""
must print content with increased verbosity
"""
log_mock = MagicMock()
package_ahriman_printer.print(verbose=True, log_fn=log_mock)
log_mock.assert_called()
def test_properties() -> None:
"""
must return empty properties list
"""
assert Printer().properties() == []
def test_title() -> None:
"""
must return empty title
"""
assert Printer().title() is None