feat: config module with TOML defaults

This commit is contained in:
2026-04-01 02:14:14 +02:00
parent 20e20f44cd
commit 8a39d8b97e
3 changed files with 83 additions and 0 deletions
View File
+25
View File
@@ -0,0 +1,25 @@
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)