init commit
This commit is contained in:
49
tests/test_config.py
Normal file
49
tests/test_config.py
Normal file
@@ -0,0 +1,49 @@
|
||||
"""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,
|
||||
MAX_FRAME_INTERVAL,
|
||||
SEGMENT_DURATION,
|
||||
)
|
||||
|
||||
|
||||
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_max_frame_interval_positive():
|
||||
assert MAX_FRAME_INTERVAL > 0
|
||||
|
||||
|
||||
def test_segment_duration_positive():
|
||||
assert SEGMENT_DURATION > 0
|
||||
Reference in New Issue
Block a user