Skip to content

Commit

Permalink
Chore: add new test using source-pokeapi and custom components.py (
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsteers authored Feb 6, 2025
1 parent ca68c5c commit e38f914
Show file tree
Hide file tree
Showing 12 changed files with 1,046 additions and 533 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# PokeAPI with Custom `components.py` API Tests

This test connector is a modified version of `source-pokeapi`. It has been modified to use custom `components.py` so we have a test case the completes quickly and _does not_ require any credentials.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""A sample implementation of custom components that does nothing but will cause syncs to fail if missing."""

from typing import Any, Mapping

import requests

from airbyte_cdk.sources.declarative.extractors import DpathExtractor


class IntentionalException(Exception):
"""This exception is raised intentionally in order to test error handling."""


class MyCustomExtractor(DpathExtractor):
"""Dummy class, directly implements DPatchExtractor.
Used to prove that SDM can find the custom class by name.
"""

pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
"""A sample implementation of custom components that does nothing but will cause syncs to fail if missing."""

from collections.abc import Iterable, MutableMapping
from dataclasses import InitVar, dataclass
from typing import Any, Mapping, Optional, Union

import requests

from airbyte_cdk.sources.declarative.extractors import DpathExtractor


class IntentionalException(Exception):
"""This exception is raised intentionally in order to test error handling."""


class MyCustomExtractor(DpathExtractor):
def extract_records(
self,
response: requests.Response,
) -> Iterable[MutableMapping[Any, Any]]:
raise IntentionalException
Loading

0 comments on commit e38f914

Please sign in to comment.