async def test_process_sync_job_in_progress(self, mock_sync_with_schedule, mock_sync_job):
        """Test processing a sync that already has a job in progress."""
        scheduler = PlatformScheduler()
        mock_db = AsyncMock()

        # Set the job status to IN_PROGRESS
        in_progress_job = mock_sync_job
        in_progress_job.status = SyncJobStatus.IN_PROGRESS

        # Create a proper mock user that will pass Pydantic validation
        mock_user = schemas.User(
            id=uuid.uuid4(),
            email="test@example.com",
            full_name="Test User",
            organization_id=uuid.uuid4(),
            is_active=True,
        )

        # Mock necessary crud operations
        with (
            patch(
                "airweave.platform.scheduler.crud.user.get_by_email",
                new_callable=AsyncMock,
                return_value=mock_user,
            ),
            patch(
                "airweave.platform.scheduler.crud.sync_job.get_latest_by_sync_id",
                new_callable=AsyncMock,
                return_value=in_progress_job,
            ),
        ):
            result = await scheduler._process_sync(mock_db, mock_sync_with_schedule)

            # Assert sync was not triggered (job in progress)
            assert result is False
Test processing a sync that already has a job in progress.
backend/tests/unit/platform/test_scheduler.py