41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
|
|
import os
|
||
|
|
import pytest
|
||
|
|
|
||
|
|
|
||
|
|
def test_yaml_defaults_load(monkeypatch):
|
||
|
|
# Clear lru_cache so each test gets a fresh load
|
||
|
|
from app.core import config as cfg_module
|
||
|
|
cfg_module.get_config.cache_clear()
|
||
|
|
|
||
|
|
# Remove env overrides that might bleed from shell environment
|
||
|
|
for var in ["MAX_VIDEO_SIZE_MB", "LOG_LEVEL", "STORAGE_ENDPOINT"]:
|
||
|
|
monkeypatch.delenv(var, raising=False)
|
||
|
|
|
||
|
|
cfg = cfg_module.get_config()
|
||
|
|
|
||
|
|
assert cfg["server"]["port"] == 8000
|
||
|
|
assert cfg["video"]["max_file_size_mb"] == 200
|
||
|
|
assert cfg["models"]["default_text"] == "glm-4-flash"
|
||
|
|
assert cfg["models"]["default_vision"] == "glm-4v-flash"
|
||
|
|
assert cfg["storage"]["buckets"]["source_data"] == "source-data"
|
||
|
|
|
||
|
|
|
||
|
|
def test_max_video_size_env_override(monkeypatch):
|
||
|
|
from app.core import config as cfg_module
|
||
|
|
cfg_module.get_config.cache_clear()
|
||
|
|
|
||
|
|
monkeypatch.setenv("MAX_VIDEO_SIZE_MB", "500")
|
||
|
|
cfg = cfg_module.get_config()
|
||
|
|
|
||
|
|
assert cfg["video"]["max_file_size_mb"] == 500
|
||
|
|
|
||
|
|
|
||
|
|
def test_log_level_env_override(monkeypatch):
|
||
|
|
from app.core import config as cfg_module
|
||
|
|
cfg_module.get_config.cache_clear()
|
||
|
|
|
||
|
|
monkeypatch.setenv("LOG_LEVEL", "DEBUG")
|
||
|
|
cfg = cfg_module.get_config()
|
||
|
|
|
||
|
|
assert cfg["server"]["log_level"] == "DEBUG"
|