34 lines
874 B
Python
34 lines
874 B
Python
"""Tests for validating the Settings object."""
|
|
import pathlib
|
|
|
|
import pytest
|
|
|
|
from playlist.data import settings
|
|
|
|
|
|
@pytest.fixture
|
|
def example_settings() -> settings.Settings:
|
|
"""Make testable Settings object."""
|
|
return settings.Settings(
|
|
creds=settings.CredentialSettings(
|
|
baseurl="http://nowhere.huh",
|
|
token="Fake Token", # noqa: S105
|
|
),
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
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
|