1
0
mirror of synced 2025-12-19 18:14:56 -05:00
Files
airbyte/airbyte-integrations/connectors/source-woocommerce/unit_tests/mock_server/utils.py

31 lines
987 B
Python

# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
from typing import List, Optional
from airbyte_cdk.models import AirbyteStateMessage, ConfiguredAirbyteCatalog, SyncMode
from airbyte_cdk.test.catalog_builder import CatalogBuilder
from airbyte_cdk.test.entrypoint_wrapper import EntrypointOutput, read
from ..conftest import get_source
from .config import ConfigBuilder
def catalog(stream_name: str, sync_mode: SyncMode) -> ConfiguredAirbyteCatalog:
return CatalogBuilder().with_stream(stream_name, sync_mode).build()
def config() -> ConfigBuilder:
return ConfigBuilder()
def read_output(
config_builder: ConfigBuilder,
stream_name: str,
sync_mode: SyncMode,
state: Optional[List[AirbyteStateMessage]] = None,
expecting_exception: bool = False,
) -> EntrypointOutput:
_catalog = catalog(stream_name, sync_mode)
_config = config_builder.build()
return read(get_source(config=_config), _config, _catalog, state, expecting_exception)