feat: initialize cold display guard
This commit is contained in:
38
tests/test_config.py
Normal file
38
tests/test_config.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from cold_display_guard.config import load_settings
|
||||
|
||||
|
||||
class ConfigTests(unittest.TestCase):
|
||||
def test_loads_settings_from_toml(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
path = Path(tmpdir) / "config.toml"
|
||||
path.write_text(
|
||||
"""
|
||||
camera_id = "cam_a"
|
||||
|
||||
[thresholds]
|
||||
max_dwell_seconds = 30
|
||||
trash_confirmation_seconds = 4
|
||||
|
||||
[layout]
|
||||
rows = 1
|
||||
cols = 2
|
||||
""".strip(),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
settings = load_settings(path)
|
||||
|
||||
self.assertEqual(settings.camera_id, "cam_a")
|
||||
self.assertEqual(settings.max_dwell_seconds, 30)
|
||||
self.assertEqual(settings.trash_confirmation_seconds, 4)
|
||||
self.assertEqual(settings.zone_ids, ("r1c1", "r1c2"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user