async def test_create_sync_without_run(
        self, mock_db, mock_user, mock_sync, mock_background_tasks
    ):
        """Test creating a sync without running it immediately."""
        # Arrange
        source_connection_id = uuid.uuid4()
        collection_id = "test-collection"

        # Create a proper mock source connection with all required fields
        mock_source_connection = MagicMock()
        mock_source_connection.id = uuid.uuid4()
        mock_source_connection.name = "Test Source Connection"
        mock_source_connection.description = "Test description"
        mock_source_connection.short_name = "test-source"
        mock_source_connection.white_label_id = None
        mock_source_connection.sync_id = uuid.uuid4()
        mock_source_connection.organization_id = uuid.uuid4()
        mock_source_connection.connection_id = uuid.uuid4()
        mock_source_connection.collection = collection_id
        mock_source_connection.readable_collection_id = collection_id
        mock_source_connection.created_by_email = "test@example.com"
        mock_source_connection.modified_by_email = "test@example.com"
        mock_source_connection.created_at = datetime.now()
        mock_source_connection.modified_at = datetime.now()
        mock_source_connection.status = SourceConnectionStatus.ACTIVE
        mock_source_connection.latest_sync_job_status = None
        mock_source_connection.latest_sync_job_id = None
        mock_source_connection.latest_sync_job_error = None
        mock_source_connection.cron_schedule = None
        mock_source_connection.auth_fields = None
        mock_source_connection.config_fields = None

        # Create a proper mock collection object with all required fields
        mock_collection = MagicMock()
        mock_collection.id = uuid.uuid4()
        mock_collection.readable_id = collection_id
        mock_collection.name = "Test Collection"
        mock_collection.organization_id = uuid.uuid4()
        mock_collection.created_by_email = "test@example.com"
        mock_collection.modified_by_email = "test@example.com"
        mock_collection.created_at = datetime.now()
        mock_collection.modified_at = datetime.now()
        mock_collection.status = CollectionStatus.ACTIVE

        sync_in = schemas.SyncCreate(
            name="Test Sync",
            description="Test description",
            source_connection_id=source_connection_id,
            destination_connection_ids=[uuid.uuid4()],
            run_immediately=False,
        )

        with (
            patch.object(
                sync_service, "create_and_run_sync", new_callable=AsyncMock
            ) as mock_create_and_run,
            patch.object(
                crud.source_connection, "get", new_callable=AsyncMock
            ) as mock_get_source_conn,
            patch.object(
                crud.collection, "get_by_readable_id", new_callable=AsyncMock
            ) as mock_get_collection,
        ):
            mock_create_and_run.return_value = (mock_sync, None)  # No sync job created
            mock_get_source_conn.return_value = mock_source_connection
            mock_get_collection.return_value = mock_collection

            # Act
            result = await sync.create_sync(
                db=mock_db,
                sync_in=sync_in,
                user=mock_user,
                background_tasks=mock_background_tasks,
            )

            # Assert
            mock_create_and_run.assert_called_once_with(
                db=mock_db, sync_in=sync_in, current_user=mock_user
            )
            assert result == mock_sync
            mock_background_tasks.add_task.assert_not_called()
Test creating a sync without running it immediately.
backend/tests/unit/api/test_sync.py