Skip to content

Commit ba7b95e

Browse files
committed
Fix test
1 parent a0f4761 commit ba7b95e

File tree

1 file changed

+88
-2
lines changed

1 file changed

+88
-2
lines changed

unit_tests/sources/declarative/resolvers/test_http_components_resolver.py

+88-2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,92 @@
111111
],
112112
}
113113

114+
_MANIFEST_WITH_DUPLICATES = {
115+
"version": "6.7.0",
116+
"type": "DeclarativeSource",
117+
"check": {"type": "CheckStream", "stream_names": ["Rates"]},
118+
"dynamic_streams": [
119+
{
120+
"type": "DynamicDeclarativeStream",
121+
"stream_template": {
122+
"type": "DeclarativeStream",
123+
"name": "",
124+
"primary_key": [],
125+
"schema_loader": {
126+
"type": "InlineSchemaLoader",
127+
"schema": {
128+
"$schema": "http://json-schema.org/schema#",
129+
"properties": {
130+
"ABC": {"type": "number"},
131+
"AED": {"type": "number"},
132+
},
133+
"type": "object",
134+
},
135+
},
136+
"retriever": {
137+
"type": "SimpleRetriever",
138+
"requester": {
139+
"type": "HttpRequester",
140+
"$parameters": {"item_id": ""},
141+
"url_base": "https://api.test.com",
142+
"path": "/items/{{parameters['item_id']}}",
143+
"http_method": "GET",
144+
"authenticator": {
145+
"type": "ApiKeyAuthenticator",
146+
"header": "apikey",
147+
"api_token": "{{ config['api_key'] }}",
148+
},
149+
},
150+
"record_selector": {
151+
"type": "RecordSelector",
152+
"extractor": {"type": "DpathExtractor", "field_path": []},
153+
},
154+
"paginator": {"type": "NoPagination"},
155+
},
156+
},
157+
"components_resolver": {
158+
"type": "HttpComponentsResolver",
159+
"retriever": {
160+
"type": "SimpleRetriever",
161+
"requester": {
162+
"type": "HttpRequester",
163+
"url_base": "https://api.test.com",
164+
"path": "duplicates_items",
165+
"http_method": "GET",
166+
"authenticator": {
167+
"type": "ApiKeyAuthenticator",
168+
"header": "apikey",
169+
"api_token": "{{ config['api_key'] }}",
170+
},
171+
},
172+
"record_selector": {
173+
"type": "RecordSelector",
174+
"extractor": {"type": "DpathExtractor", "field_path": []},
175+
},
176+
"paginator": {"type": "NoPagination"},
177+
},
178+
"components_mapping": [
179+
{
180+
"type": "ComponentMappingDefinition",
181+
"field_path": ["name"],
182+
"value": "{{components_values['name']}}",
183+
},
184+
{
185+
"type": "ComponentMappingDefinition",
186+
"field_path": [
187+
"retriever",
188+
"requester",
189+
"$parameters",
190+
"item_id",
191+
],
192+
"value": "{{components_values['id']}}",
193+
},
194+
],
195+
},
196+
}
197+
],
198+
}
199+
114200

115201
@pytest.mark.parametrize(
116202
"components_mapping, retriever_data, stream_template_config, expected_result",
@@ -198,7 +284,7 @@ def test_dynamic_streams_read_with_http_components_resolver():
198284
def test_duplicated_dynamic_streams_read_with_http_components_resolver():
199285
with HttpMocker() as http_mocker:
200286
http_mocker.get(
201-
HttpRequest(url="https://api.test.com/items"),
287+
HttpRequest(url="https://api.test.com/duplicates_items"),
202288
HttpResponse(
203289
body=json.dumps(
204290
[
@@ -212,7 +298,7 @@ def test_duplicated_dynamic_streams_read_with_http_components_resolver():
212298

213299
with pytest.raises(AirbyteTracedException) as exc_info:
214300
source = ConcurrentDeclarativeSource(
215-
source_config=_MANIFEST, config=_CONFIG, catalog=None, state=None
301+
source_config=_MANIFEST_WITH_DUPLICATES, config=_CONFIG, catalog=None, state=None
216302
)
217303
source.discover(logger=source.logger, config=_CONFIG)
218304
assert (

0 commit comments

Comments
 (0)