migration of jinja tempaltes to bootstrap (#30)

This commit is contained in:
2021-09-05 05:27:58 +03:00
committed by GitHub
parent f49894107a
commit 19ba2ba8e5
25 changed files with 313 additions and 412 deletions

View File

@ -1,5 +1,7 @@
import configparser
from pathlib import Path
import pytest
from pytest_mock import MockerFixture
from ahriman.core.configuration import Configuration
@ -49,6 +51,25 @@ def test_absolute_path_for_relative(configuration: Configuration) -> None:
assert result.name == path.name
def test_path_with_fallback(configuration: Configuration) -> None:
"""
must return fallback path
"""
path = Path("a")
assert configuration.getpath("some", "option", fallback=path).name == str(path)
assert configuration.getpath("some", "option", fallback=None) is None
def test_path_without_fallback(configuration: Configuration) -> None:
"""
must raise exception without fallback
"""
with pytest.raises(configparser.NoSectionError):
assert configuration.getpath("some", "option")
with pytest.raises(configparser.NoOptionError):
assert configuration.getpath("build", "option")
def test_dump(configuration: Configuration) -> None:
"""
dump must not be empty