async def test_get_all_sources(db_session: AsyncSession, skip_if_no_db):
    """Test getting all sources with pagination."""
    # Arrange - Create multiple sources
    sources_to_create = 5
    created_ids = []

    try:
        for i in range(sources_to_create):
            unique_id = uuid.uuid4().hex[:8]
            source_data = SourceCreate(
                name=f"Test Source {i}",
                short_name=f"test_source_{i}_{unique_id}",
                class_name="TestSourceConnector",
                auth_type=None,
                auth_config_class="TestAuthConfig",
                config_class="TestConfig",
                description=f"Test source {i} for get_all test",
                organization_id=None,
                output_entity_definition_ids=[],
                config_schema={"type": "object", "properties": {}},
            )

            created_source = await crud_source.create(db=db_session, obj_in=source_data)
            created_ids.append(created_source.id)

        # Act - Get all with default pagination
        all_sources = await crud_source.get_all(db=db_session)

        # Assert
        assert len(all_sources) >= sources_to_create

        # Check if our created sources are in the result
        created_sources_found = 0
        for source in all_sources:
            if source.id in created_ids:
                created_sources_found += 1

        assert created_sources_found == sources_to_create

        # Act - Test pagination (skip 2, limit 2)
        paginated_sources = await crud_source.get_all(db=db_session, skip=2, limit=2, disable_limit=False)

        # Assert
        assert len(paginated_sources) <= 2

    except Exception as e:
        logger.error(f"Test failed: {e}")
        raise
Test getting all sources with pagination.
backend/tests/integration/crud/test_source_integration.py