Got tests for settings.
Signed-off-by: Cliff Hill <xlorep@darkhelm.org>
This commit is contained in:
30
tests/data/test_settings.py
Normal file
30
tests/data/test_settings.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""Tests for validating the Settings object."""
|
||||
import pathlib
|
||||
|
||||
import pytest # type: ignore [import]
|
||||
|
||||
from playlist.data import settings # type: ignore [import]
|
||||
|
||||
|
||||
@pytest.fixture # type: ignore [misc]
|
||||
def example_settings() -> settings.Settings:
|
||||
"""Make testable Settings object."""
|
||||
return settings.Settings(
|
||||
creds=settings.CredentialSettings(baseurl="http://nowhere.huh", token="12345"),
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture # type: ignore [misc]
|
||||
def settings_filepath(tmp_path: pathlib.Path) -> pathlib.Path:
|
||||
"""Get the path to use for the settings file."""
|
||||
return tmp_path / "fake_settings.yaml"
|
||||
|
||||
|
||||
def test_yaml(
|
||||
example_settings: settings.Settings,
|
||||
settings_filepath: pathlib.Path,
|
||||
) -> None:
|
||||
"""Test the YAML read/write operations."""
|
||||
example_settings.yaml_write(settings_filepath)
|
||||
result = example_settings.yaml_read(settings_filepath)
|
||||
assert result == example_settings
|
||||
Reference in New Issue
Block a user