Files
jellyfin-client/tests/test_config.py
T

39 lines
999 B
Python

import tempfile
from pathlib import Path
from src.config import AppConfig
def test_default_config():
cfg = AppConfig.load()
assert cfg.jellyfin.client_name == "Jellyfin HTPC Client"
assert cfg.player.hwdec == "auto"
assert cfg.kodi_rpc.http_port == 8080
assert cfg.web_api.port == 8097
def test_custom_yaml_config():
yaml_content = """
jellyfin:
server_url: "https://media.lan"
username: "myuser"
password: "mypassword"
player:
hwdec: "vaapi"
fullscreen: false
kodi_rpc:
http_port: 8088
"""
with tempfile.NamedTemporaryFile("w", suffix=".yaml", delete=False) as f:
f.write(yaml_content)
f_path = f.name
try:
cfg = AppConfig.load(f_path)
assert cfg.jellyfin.server_url == "https://media.lan"
assert cfg.jellyfin.username == "myuser"
assert cfg.player.hwdec == "vaapi"
assert cfg.player.fullscreen is False
assert cfg.kodi_rpc.http_port == 8088
finally:
Path(f_path).unlink()