1
0
mirror of synced 2025-12-20 10:32:35 -05:00
Files
airbyte/airbyte-integrations/connectors/source-twilio/unit_tests/conftest.py
devin-ai-integration[bot] c2df299e9f fix(source-twilio): Handle 404 errors gracefully for date ranges with no data (#68680)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Alfredo Garcia <alfredo.garcia@hallmark.edu>
Co-authored-by: alfredo.garcia@airbyte.io <freddy.garcia7.fg@gmail.com>
Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
2025-11-06 15:54:57 -06:00

43 lines
1.4 KiB
Python

# Copyright (c) 2025 Airbyte, Inc., all rights reserved.
import sys
from pathlib import Path
import pytest
from airbyte_cdk.sources.declarative.yaml_declarative_source import YamlDeclarativeSource
from airbyte_cdk.test.catalog_builder import CatalogBuilder
from airbyte_cdk.test.state_builder import StateBuilder
pytest_plugins = ["airbyte_cdk.test.utils.manifest_only_fixtures"]
TEST_CONFIG = {
"account_sid": "AC123",
"auth_token": "secret",
"start_date": "2021-01-01T00:00:00Z",
"lookback_window": 0,
}
@pytest.fixture
def http_mocker() -> None:
"""This fixture is needed to pass http_mocker parameter from the @HttpMocker decorator to a test"""
def _get_manifest_path() -> Path:
source_declarative_manifest_path = Path("/airbyte/integration_code/source_declarative_manifest")
if source_declarative_manifest_path.exists():
return source_declarative_manifest_path
return Path(__file__).parent.parent
_SOURCE_FOLDER_PATH = _get_manifest_path()
_YAML_FILE_PATH = _SOURCE_FOLDER_PATH / "manifest.yaml"
sys.path.append(str(_SOURCE_FOLDER_PATH)) # to allow loading custom components
def get_source(config, state=None) -> YamlDeclarativeSource:
catalog = CatalogBuilder().build()
state = StateBuilder().build() if not state else state
return YamlDeclarativeSource(path_to_yaml=str(_YAML_FILE_PATH), catalog=catalog, config=config, state=state)