Skip to content

Commit e38f914

Browse files
authored
Chore: add new test using source-pokeapi and custom components.py (#317)
1 parent ca68c5c commit e38f914

File tree

12 files changed

+1046
-533
lines changed

12 files changed

+1046
-533
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# PokeAPI with Custom `components.py` API Tests
2+
3+
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.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"""A sample implementation of custom components that does nothing but will cause syncs to fail if missing."""
2+
3+
from typing import Any, Mapping
4+
5+
import requests
6+
7+
from airbyte_cdk.sources.declarative.extractors import DpathExtractor
8+
9+
10+
class IntentionalException(Exception):
11+
"""This exception is raised intentionally in order to test error handling."""
12+
13+
14+
class MyCustomExtractor(DpathExtractor):
15+
"""Dummy class, directly implements DPatchExtractor.
16+
17+
Used to prove that SDM can find the custom class by name.
18+
"""
19+
20+
pass
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3+
#
4+
"""A sample implementation of custom components that does nothing but will cause syncs to fail if missing."""
5+
6+
from collections.abc import Iterable, MutableMapping
7+
from dataclasses import InitVar, dataclass
8+
from typing import Any, Mapping, Optional, Union
9+
10+
import requests
11+
12+
from airbyte_cdk.sources.declarative.extractors import DpathExtractor
13+
14+
15+
class IntentionalException(Exception):
16+
"""This exception is raised intentionally in order to test error handling."""
17+
18+
19+
class MyCustomExtractor(DpathExtractor):
20+
def extract_records(
21+
self,
22+
response: requests.Response,
23+
) -> Iterable[MutableMapping[Any, Any]]:
24+
raise IntentionalException

0 commit comments

Comments
 (0)