26 lines
861 B
Python
26 lines
861 B
Python
import os
|
|
import tempfile
|
|
from unittest.mock import patch
|
|
|
|
|
|
def test_config_loads_defaults():
|
|
with tempfile.TemporaryDirectory() as tmpdir:
|
|
cfg_path = os.path.join(tmpdir, "config.toml")
|
|
with patch("config.CONFIG_PATH", cfg_path):
|
|
import importlib, config
|
|
importlib.reload(config)
|
|
cfg = config.load()
|
|
assert cfg["ollama"]["model"] == "gemma3:12b"
|
|
assert cfg["whisper"]["model"] == "large-v3"
|
|
assert cfg["server"]["port"] == 8765
|
|
|
|
|
|
def test_config_creates_file_on_first_run():
|
|
with tempfile.TemporaryDirectory() as tmpdir:
|
|
import importlib, config
|
|
importlib.reload(config)
|
|
cfg_path = os.path.join(tmpdir, "config.toml")
|
|
with patch("config.CONFIG_PATH", cfg_path):
|
|
config.load()
|
|
assert os.path.exists(cfg_path)
|