test(edge): cover ghost/zone env overrides and config defaults
This commit is contained in:
parent
a63a5918cc
commit
e74cc7f898
1 changed files with 9 additions and 0 deletions
|
|
@ -5,6 +5,12 @@ def test_defaults_when_env_empty():
|
||||||
assert cfg.device_id == "pi-unknown"
|
assert cfg.device_id == "pi-unknown"
|
||||||
assert cfg.fall.prone_confirm_s == 3.0
|
assert cfg.fall.prone_confirm_s == 3.0
|
||||||
assert cfg.fall.no_motion_s == 10.0
|
assert cfg.fall.no_motion_s == 10.0
|
||||||
|
assert cfg.camera_id == "cam-01"
|
||||||
|
assert cfg.cafe24_url == ""
|
||||||
|
assert cfg.secret == ""
|
||||||
|
assert cfg.ghost.reappear_s == 10.0
|
||||||
|
assert cfg.zone.debounce_s == 0.75
|
||||||
|
assert cfg.engine.cooldown_s == 30.0
|
||||||
|
|
||||||
def test_env_overrides():
|
def test_env_overrides():
|
||||||
env = {
|
env = {
|
||||||
|
|
@ -12,6 +18,7 @@ def test_env_overrides():
|
||||||
"CAFE24_URL": "https://x/api/events", "DEVICE_SECRET": "s",
|
"CAFE24_URL": "https://x/api/events", "DEVICE_SECRET": "s",
|
||||||
"FALL_PRONE_S": "2.0", "FALL_NO_MOTION_S": "8",
|
"FALL_PRONE_S": "2.0", "FALL_NO_MOTION_S": "8",
|
||||||
"IMMOBILE_S": "90", "COOLDOWN_S": "45",
|
"IMMOBILE_S": "90", "COOLDOWN_S": "45",
|
||||||
|
"GHOST_REAPPEAR_S": "7", "ZONE_DEBOUNCE_S": "1.5",
|
||||||
}
|
}
|
||||||
cfg = load_config(env)
|
cfg = load_config(env)
|
||||||
assert cfg.device_id == "pi-w1"
|
assert cfg.device_id == "pi-w1"
|
||||||
|
|
@ -21,3 +28,5 @@ def test_env_overrides():
|
||||||
assert cfg.immobility.immobile_s == 90.0
|
assert cfg.immobility.immobile_s == 90.0
|
||||||
assert cfg.engine.cooldown_s == 45.0
|
assert cfg.engine.cooldown_s == 45.0
|
||||||
assert cfg.engine.camera_id == "cam-9"
|
assert cfg.engine.camera_id == "cam-9"
|
||||||
|
assert cfg.ghost.reappear_s == 7.0
|
||||||
|
assert cfg.zone.debounce_s == 1.5
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue