feat: config module with TOML defaults
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user