mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-06-28 06:41:43 +00:00
remove own implementations of getlist and getpath method in order to use
converters feature
This commit is contained in:
@ -67,27 +67,26 @@ def test_execute_single(args: argparse.Namespace, mocker: MockerFixture) -> None
|
||||
starmap_mock.assert_not_called()
|
||||
|
||||
|
||||
def test_extract_architectures(args: argparse.Namespace, mocker: MockerFixture) -> None:
|
||||
def test_extract_architectures(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must generate list of available architectures
|
||||
"""
|
||||
args.architecture = []
|
||||
args.configuration = Path("")
|
||||
mocker.patch("ahriman.core.configuration.Configuration.getpath")
|
||||
args.configuration = configuration.path
|
||||
known_architectures_mock = mocker.patch("ahriman.models.repository_paths.RepositoryPaths.known_architectures")
|
||||
|
||||
Handler.extract_architectures(args)
|
||||
known_architectures_mock.assert_called_once()
|
||||
|
||||
|
||||
def test_extract_architectures_empty(args: argparse.Namespace, mocker: MockerFixture) -> None:
|
||||
def test_extract_architectures_empty(args: argparse.Namespace, configuration: Configuration,
|
||||
mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must raise exception if no available architectures found
|
||||
"""
|
||||
args.architecture = []
|
||||
args.command = "config"
|
||||
args.configuration = Path("")
|
||||
mocker.patch("ahriman.core.configuration.Configuration.getpath")
|
||||
args.configuration = configuration.path
|
||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.known_architectures", return_value=set())
|
||||
|
||||
with pytest.raises(MissingArchitecture):
|
||||
|
@ -3,6 +3,7 @@ import pytest
|
||||
from pathlib import Path
|
||||
from pytest_mock import MockerFixture
|
||||
from unittest import mock
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from ahriman.core.report.report import Report
|
||||
from ahriman.core.repository.executor import Executor
|
||||
@ -137,14 +138,13 @@ def test_process_report(executor: Executor, package_ahriman: Package, mocker: Mo
|
||||
report_mock.assert_called_once()
|
||||
|
||||
|
||||
def test_process_report_auto(executor: Executor, mocker: MockerFixture) -> None:
|
||||
def test_process_report_auto(executor: Executor) -> None:
|
||||
"""
|
||||
must process report in auto mode if no targets supplied
|
||||
"""
|
||||
configuration_getlist_mock = mocker.patch("ahriman.core.configuration.Configuration.getlist")
|
||||
|
||||
configuration_mock = executor.configuration = MagicMock()
|
||||
executor.process_report(None, [])
|
||||
configuration_getlist_mock.assert_called_once()
|
||||
configuration_mock.getlist.assert_called_once()
|
||||
|
||||
|
||||
def test_process_upload(executor: Executor, mocker: MockerFixture) -> None:
|
||||
@ -158,14 +158,13 @@ def test_process_upload(executor: Executor, mocker: MockerFixture) -> None:
|
||||
upload_mock.assert_called_once()
|
||||
|
||||
|
||||
def test_process_upload_auto(executor: Executor, mocker: MockerFixture) -> None:
|
||||
def test_process_upload_auto(executor: Executor) -> None:
|
||||
"""
|
||||
must process sync in auto mode if no targets supplied
|
||||
"""
|
||||
configuration_getlist_mock = mocker.patch("ahriman.core.configuration.Configuration.getlist")
|
||||
|
||||
configuration_mock = executor.configuration = MagicMock()
|
||||
executor.process_sync(None, [])
|
||||
configuration_getlist_mock.assert_called_once()
|
||||
configuration_mock.getlist.assert_called_once()
|
||||
|
||||
|
||||
def test_process_update(executor: Executor, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||
|
@ -104,7 +104,7 @@ def test_getlist_empty(configuration: Configuration) -> None:
|
||||
"""
|
||||
must return list of string correctly for non-existing option
|
||||
"""
|
||||
assert configuration.getlist("build", "test_list") == []
|
||||
assert configuration.getlist("build", "test_list", fallback=[]) == []
|
||||
configuration.set_option("build", "test_list", "")
|
||||
assert configuration.getlist("build", "test_list") == []
|
||||
|
||||
|
Reference in New Issue
Block a user