Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MateoLostanlen committed Jul 29, 2024
1 parent 7723128 commit c58c72d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")
Expand Down

0 comments on commit c58c72d

Please sign in to comment.