mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-01-23 04:28:32 +03:00
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
* Change default event retention * Update docs * Handle both record and event record * Catch edge case * Undo motion change and improve motion behavior * fix typo * Remove record retention banner * Remove unused * Fix tests
34 lines
1.4 KiB
Python
34 lines
1.4 KiB
Python
import unittest
|
|
|
|
from frigate.config import RetainModeEnum
|
|
from frigate.record.maintainer import SegmentInfo
|
|
|
|
|
|
class TestRecordRetention(unittest.TestCase):
|
|
def test_motion_should_keep_motion_not_object(self):
|
|
segment_info = SegmentInfo(
|
|
motion_count=1, active_object_count=0, region_count=0, average_dBFS=0
|
|
)
|
|
assert not segment_info.should_discard_segment(RetainModeEnum.motion)
|
|
assert segment_info.should_discard_segment(RetainModeEnum.active_objects)
|
|
|
|
def test_object_should_keep_object_when_motion(self):
|
|
segment_info = SegmentInfo(
|
|
motion_count=0, active_object_count=1, region_count=0, average_dBFS=0
|
|
)
|
|
assert not segment_info.should_discard_segment(RetainModeEnum.motion)
|
|
assert not segment_info.should_discard_segment(RetainModeEnum.active_objects)
|
|
|
|
def test_all_should_keep_all(self):
|
|
segment_info = SegmentInfo(
|
|
motion_count=0, active_object_count=0, region_count=0, average_dBFS=0
|
|
)
|
|
assert not segment_info.should_discard_segment(RetainModeEnum.all)
|
|
|
|
def test_should_keep_audio_in_motion_mode(self):
|
|
segment_info = SegmentInfo(
|
|
motion_count=0, active_object_count=0, region_count=0, average_dBFS=1
|
|
)
|
|
assert not segment_info.should_discard_segment(RetainModeEnum.motion)
|
|
assert segment_info.should_discard_segment(RetainModeEnum.active_objects)
|