async def test_get_active_syncs_with_schedule(self, mock_sync_multiple):
        """Test getting active syncs with schedules."""
        scheduler = PlatformScheduler()
        mock_db = AsyncMock()

        # Setup mock query results for db.execute
        mock_scalar_result = Mock()
        mock_scalar_result.unique = Mock(return_value=mock_scalar_result)  # Add unique() mock
        mock_scalar_result.all.return_value = mock_sync_multiple
        mock_execute_result = Mock()
        mock_execute_result.scalars.return_value = mock_scalar_result

        # Make execute() an AsyncMock that returns the expected result
        mock_db.execute = AsyncMock(return_value=mock_execute_result)

        # Mock crud.sync.get_all_with_schedule to return the mock_sync_multiple directly
        with patch(
            "airweave.platform.scheduler.crud.sync.get_all_with_schedule",
            new_callable=AsyncMock,
            return_value=mock_sync_multiple,
        ):
            result = await scheduler._get_active_syncs_with_schedule(mock_db)

            # Assert database was queried and results processed
            crud.sync.get_all_with_schedule.assert_called_once_with(mock_db)
            assert len(result) == len(mock_sync_multiple)
Test getting active syncs with schedules.
backend/tests/unit/platform/test_scheduler.py