Files
mitus/tests/test_config.py

57 lines
1.1 KiB
Python

"""Tests for cht.config — verify defaults are sane."""
from pathlib import Path
from cht.config import (
APP_ID,
APP_NAME,
DATA_DIR,
SESSIONS_DIR,
STREAM_HOST,
STREAM_PORT,
SCENE_THRESHOLD,
SCENE_FLUSH_FRAMES,
SEGMENT_DURATION,
AUDIO_EXTRACT_INTERVAL,
AUDIO_SAFETY_MARGIN,
)
def test_app_id_format():
assert "." in APP_ID
assert APP_ID.startswith("com.")
def test_data_dir_under_home():
assert str(DATA_DIR).startswith(str(Path.home()))
def test_sessions_dir_under_data():
assert str(SESSIONS_DIR).startswith(str(DATA_DIR))
def test_stream_host_binds_all():
assert STREAM_HOST == "0.0.0.0"
def test_stream_port_is_int():
assert isinstance(STREAM_PORT, int)
assert 1024 <= STREAM_PORT <= 65535
def test_scene_threshold_range():
assert 0 < SCENE_THRESHOLD < 1
def test_scene_flush_frames_non_negative():
assert SCENE_FLUSH_FRAMES >= 0
def test_audio_intervals_positive():
assert AUDIO_EXTRACT_INTERVAL > 0
assert AUDIO_SAFETY_MARGIN > 0
def test_segment_duration_positive():
assert SEGMENT_DURATION > 0