From c58c72d902ecd42e18350e6201bfe51ea0ad9f9b Mon Sep 17 00:00:00 2001 From: MateoLostanlen Date: Mon, 29 Jul 2024 16:32:53 +0200 Subject: [PATCH] update tests --- tests/test_core.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/test_core.py b/tests/test_core.py index ef1c4f2..42a21f9 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -34,6 +34,16 @@ def mock_cameras_ptz(mock_wildfire_image): return [camera] +@pytest.fixture +def mock_cameras_ptz_night(): + camera = MagicMock() + camera.capture.return_value = Image.new("RGB", (100, 100), (255, 255, 255)) # Mock captured image + camera.cam_type = "ptz" + camera.cam_poses = [1, 2] + camera.ip_address = "192.168.1.1" + return [camera] + + @pytest.fixture def system_controller(mock_engine, mock_cameras): return SystemController(engine=mock_engine, cameras=mock_cameras) @@ -44,6 +54,21 @@ def system_controller_ptz(mock_engine, mock_cameras_ptz): return SystemController(engine=mock_engine, cameras=mock_cameras_ptz) +@pytest.fixture +def system_controller_ptz_night(mock_engine, mock_cameras_ptz_night): + return SystemController(engine=mock_engine, cameras=mock_cameras_ptz_night) + + +@pytest.mark.asyncio +async def test_night_mode(system_controller): + assert await system_controller.night_mode() + + +@pytest.mark.asyncio +async def test_night_mode_ptz(system_controller_ptz_night): + assert not await system_controller_ptz_night.night_mode() + + def test_is_day_time_ir_strategy(mock_wildfire_image): # Use day image assert is_day_time(None, mock_wildfire_image, "ir")