|
23 | 23 | SmartDetectAudioType, |
24 | 24 | VideoMode, |
25 | 25 | ) |
26 | | -from uiprotect.data.devices import CameraZone, Hotplug, HotplugExtender, WifiStats |
| 26 | +from uiprotect.data.devices import ( |
| 27 | + CameraChannel, |
| 28 | + CameraZone, |
| 29 | + Hotplug, |
| 30 | + HotplugExtender, |
| 31 | + WifiStats, |
| 32 | +) |
27 | 33 | from uiprotect.data.types import DEFAULT, PermissionNode, SmartDetectObjectType |
28 | 34 | from uiprotect.data.websocket import WSAction, WSSubscriptionMessage |
29 | 35 | from uiprotect.exceptions import BadRequest, NotAuthorized |
30 | 36 | from uiprotect.utils import to_js_time |
31 | 37 |
|
32 | 38 |
|
| 39 | +@pytest.mark.parametrize( |
| 40 | + ("channel_id", "fps", "expected"), |
| 41 | + [ |
| 42 | + (3, 2, True), # Package channel with low fps (legacy behavior) |
| 43 | + (3, 15, True), # Package channel with higher fps (G6 Entry) |
| 44 | + (3, None, False), # Package channel with no fps |
| 45 | + (0, 2, False), # Non-package channel with low fps |
| 46 | + (1, 15, False), # Non-package channel |
| 47 | + (2, None, False), # Non-package channel with no fps |
| 48 | + ], |
| 49 | +) |
| 50 | +def test_camera_channel_is_package(channel_id: int, fps: int | None, expected: bool): |
| 51 | + """Test CameraChannel.is_package uses channel id == 3 for detection.""" |
| 52 | + channel = CameraChannel.from_unifi_dict( |
| 53 | + id=channel_id, |
| 54 | + videoId="test", |
| 55 | + name="test", |
| 56 | + enabled=True, |
| 57 | + isRtspEnabled=False, |
| 58 | + width=1920, |
| 59 | + height=1080, |
| 60 | + fps=fps, |
| 61 | + bitrate=1000, |
| 62 | + fpsValues=[], |
| 63 | + idrInterval=1, |
| 64 | + ) |
| 65 | + assert channel.is_package is expected |
| 66 | + |
| 67 | + |
33 | 68 | @pytest.mark.parametrize( |
34 | 69 | ("link_speed", "expected_type"), |
35 | 70 | [ |
|
0 commit comments