@@ -166,8 +166,8 @@ def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapp
166166
167167
168168_CONFIG = {"start_date" : "2024-07-01T00:00:00.000Z" , "custom_streams" : [
169- {"id" : 1 , "name" : "item_1 " },
170- {"id" : 2 , "name" : "item_2 " },
169+ {"id" : 3 , "name" : "item_3 " },
170+ {"id" : 4 , "name" : "item_4 " },
171171]}
172172
173173_MANIFEST_WITHOUT_CHECK_COMPONENT = {
@@ -342,6 +342,17 @@ def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapp
342342 },
343343 "name" : "static_stream" ,
344344 "primary_key" : "id" ,
345+ "schema_loader" : {
346+ "type" : "InlineSchemaLoader" ,
347+ "schema" : {
348+ "$schema" : "http://json-schema.org/schema#" ,
349+ "properties" : {
350+ "id" : {"type" : "integer" },
351+ "name" : {"type" : "string" },
352+ },
353+ "type" : "object" ,
354+ },
355+ }
345356 }
346357 ]
347358}
@@ -355,18 +366,19 @@ def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapp
355366 pytest .param ({"check" : {"type" : "CheckStream" , "stream_names" : ["static_stream" ],
356367 "dynamic_streams_check_configs" : [
357368 {"type" : "DynamicStreamCheckConfig" , "dynamic_stream_name" : "http_dynamic_stream" ,
358- "stream_count" : 2 }]}}, id = "test_check_static_streams_and_http_dynamic_stream" ),
369+ "stream_count" : 1 }]}}, id = "test_check_static_streams_and_http_dynamic_stream" ),
359370 pytest .param ({"check" : {"type" : "CheckStream" , "stream_names" : ["static_stream" ],
360371 "dynamic_streams_check_configs" : [
361- {"type" : "DynamicStreamCheckConfig" , "dynamic_stream_name" : "http_dynamic_stream " ,
362- "stream_count" : 2 }]}}, id = "test_check_static_streams_and_config_dynamic_stream" ),
363- pytest .param ({"check" : {"type" : "CheckStream" , "dynamic_streams_check_configs" : [
364- {"type" : "DynamicStreamCheckConfig" , "dynamic_stream_name" : "http_dynamic_stream" , "stream_count" : 2 }]}},
372+ {"type" : "DynamicStreamCheckConfig" , "dynamic_stream_name" : "dynamic_stream_1 " ,
373+ "stream_count" : 1 }]}}, id = "test_check_static_streams_and_config_dynamic_stream" ),
374+ pytest .param ({"check" : {"type" : "CheckStream" , "dynamic_streams_check_configs" : [{ "type" : "DynamicStreamCheckConfig" , "dynamic_stream_name" : "dynamic_stream_1" ,
375+ "stream_count" : 1 }, {"type" : "DynamicStreamCheckConfig" , "dynamic_stream_name" : "http_dynamic_stream" }]}},
365376 id = "test_check_http_dynamic_stream_and_config_dynamic_stream" ),
366377 pytest .param ({"check" : {"type" : "CheckStream" , "stream_names" : ["static_stream" ],
367378 "dynamic_streams_check_configs" : [
368- {"type" : "DynamicStreamCheckConfig" , "dynamic_stream_name" : "http_dynamic_stream" ,
369- "stream_count" : 2 }]}},
379+ {"type" : "DynamicStreamCheckConfig" , "dynamic_stream_name" : "dynamic_stream_1" ,
380+ "stream_count" : 1 },
381+ {"type" : "DynamicStreamCheckConfig" , "dynamic_stream_name" : "http_dynamic_stream" }]}},
370382 id = "test_check_static_streams_and_http_dynamic_stream_and_config_dynamic_stream" ),
371383 ],
372384)
@@ -388,7 +400,10 @@ def test_check_stream(check_component):
388400
389401 item_request = HttpRequest (url = "https://api.test.com/items/1" )
390402 item_response = HttpResponse (body = json .dumps ([]), status_code = 200 )
391- item_request_count = 1
403+ http_mocker .get (item_request , item_response )
404+
405+ item_request = HttpRequest (url = "https://api.test.com/items/3" )
406+ item_response = HttpResponse (body = json .dumps ([]), status_code = 200 )
392407 http_mocker .get (item_request , item_response )
393408
394409 source = ConcurrentDeclarativeSource (
@@ -400,6 +415,16 @@ def test_check_stream(check_component):
400415
401416 stream_is_available , reason = source .check_connection (logger , _CONFIG )
402417
403- http_mocker .assert_number_of_calls (item_request , item_request_count )
404-
405418 assert stream_is_available
419+
420+
421+ def test_check_stream_only_type_provided ():
422+ manifest = {** deepcopy (_MANIFEST_WITHOUT_CHECK_COMPONENT ), ** {"check" : {"type" : "CheckStream" }}}
423+ source = ConcurrentDeclarativeSource (
424+ source_config = manifest ,
425+ config = _CONFIG ,
426+ catalog = None ,
427+ state = None ,
428+ )
429+ with pytest .raises (ValueError ):
430+ source .check_connection (logger , _CONFIG )
0 commit comments