Skip to content

Commit

Permalink
airbyte-cdk: add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
aldogonzalez8 committed Jan 6, 2025
1 parent 064eb6d commit 100ce81
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2628,6 +2628,42 @@ def test_create_custom_schema_loader():
assert isinstance(component, MyCustomSchemaLoader)


class MyCustomRetriever(SimpleRetriever):
pass


def test_create_custom_retriever():
stream_model = {
"type": "DeclarativeStream",
"retriever": {
"type": "CustomRetriever",
"class_name": "unit_tests.sources.declarative.parsers.test_model_to_component_factory.MyCustomRetriever",
"record_selector": {
"type": "RecordSelector",
"extractor": {
"type": "DpathExtractor",
"field_path": [],
},
"$parameters": { "name": ""}
},
"requester": {
"type": "HttpRequester",
"name": "list",
"url_base": "orange.com",
"path": "/v1/api",
"$parameters": {"name": ""}
},
},
}

stream = factory.create_component(
model_type=DeclarativeStreamModel, component_definition=stream_model, config=input_config
)

assert isinstance(stream, DeclarativeStream)
assert isinstance(stream.retriever, MyCustomRetriever)


@freezegun.freeze_time("2021-01-01 00:00:00")
@pytest.mark.parametrize(
"config, manifest, expected",
Expand Down

0 comments on commit 100ce81

Please sign in to comment.