@@ -31,15 +31,12 @@ def test_build_catalog_creates_correct_structure(self):
3131 assert configured_stream .sync_mode == SyncMode .incremental
3232 assert configured_stream .destination_sync_mode == DestinationSyncMode .overwrite
3333
34- @patch ("airbyte_cdk.manifest_server.command_processor.utils.ManifestDeclarativeSource" )
35- @patch ("airbyte_cdk.manifest_server.command_processor.utils.ModelToComponentFactory" )
34+ @patch ("airbyte_cdk.manifest_server.command_processor.utils.ConcurrentDeclarativeSource" )
3635 def test_build_source_creates_manifest_declarative_source (
37- self , mock_component_factory_class , mock_source_class
36+ self , mock_source_class
3837 ):
39- """Test that build_source creates a ManifestDeclarativeSource with correct parameters."""
38+ """Test that build_source creates a ConcurrentDeclarativeSource with correct parameters."""
4039 # Setup mocks
41- mock_component_factory = Mock ()
42- mock_component_factory_class .return_value = mock_component_factory
4340 mock_source = Mock ()
4441 mock_source_class .return_value = mock_source
4542
@@ -68,64 +65,57 @@ def test_build_source_creates_manifest_declarative_source(
6865 "timeout" : 30 ,
6966 }
7067
71- # Call build_source
72- result = build_source (manifest , config )
68+ # Call build_source with additional parameters
69+ catalog = build_catalog ("test_stream" )
70+ state = []
71+ result = build_source (manifest , catalog , config , state )
7372
74- # Verify ModelToComponentFactory was created with correct parameters
75- mock_component_factory_class .assert_called_once_with (
76- emit_connector_builder_messages = True ,
77- limit_pages_fetched_per_slice = None ,
78- limit_slices_fetched = None ,
79- disable_retries = True ,
80- disable_cache = True ,
81- )
82-
83- # Verify ManifestDeclarativeSource was created with correct parameters
73+ # Verify ConcurrentDeclarativeSource was created with correct parameters
8474 mock_source_class .assert_called_once_with (
75+ catalog = catalog ,
76+ state = state ,
8577 source_config = manifest ,
8678 config = config ,
8779 normalize_manifest = False , # Default when flag not set
8880 migrate_manifest = False , # Default when flag not set
8981 emit_connector_builder_messages = True ,
90- component_factory = mock_component_factory ,
82+ limits = mock_source_class . call_args [ 1 ][ "limits" ] ,
9183 )
9284
9385 assert result == mock_source
9486
95- @patch ("airbyte_cdk.manifest_server.command_processor.utils.ManifestDeclarativeSource" )
96- @patch ("airbyte_cdk.manifest_server.command_processor.utils.ModelToComponentFactory" )
87+ @patch ("airbyte_cdk.manifest_server.command_processor.utils.ConcurrentDeclarativeSource" )
9788 def test_build_source_with_normalize_flag (
98- self , mock_component_factory_class , mock_source_class
89+ self , mock_source_class
9990 ):
10091 """Test build_source when normalize flag is set."""
101- mock_component_factory = Mock ()
102- mock_component_factory_class .return_value = mock_component_factory
10392 mock_source = Mock ()
10493 mock_source_class .return_value = mock_source
10594
10695 manifest = {"streams" : [{"name" : "test_stream" }], SHOULD_NORMALIZE_KEY : True }
10796 config = {"api_key" : "test_key" }
97+ catalog = build_catalog ("test_stream" )
98+ state = []
10899
109- build_source (manifest , config )
100+ build_source (manifest , catalog , config , state )
110101
111102 # Verify normalize_manifest is True
112103 call_args = mock_source_class .call_args [1 ]
113104 assert call_args ["normalize_manifest" ] is True
114105 assert call_args ["migrate_manifest" ] is False
115106
116- @patch ("airbyte_cdk.manifest_server.command_processor.utils.ManifestDeclarativeSource" )
117- @patch ("airbyte_cdk.manifest_server.command_processor.utils.ModelToComponentFactory" )
118- def test_build_source_with_migrate_flag (self , mock_component_factory_class , mock_source_class ):
107+ @patch ("airbyte_cdk.manifest_server.command_processor.utils.ConcurrentDeclarativeSource" )
108+ def test_build_source_with_migrate_flag (self , mock_source_class ):
119109 """Test build_source when migrate flag is set."""
120- mock_component_factory = Mock ()
121- mock_component_factory_class .return_value = mock_component_factory
122110 mock_source = Mock ()
123111 mock_source_class .return_value = mock_source
124112
125113 manifest = {"streams" : [{"name" : "test_stream" }], SHOULD_MIGRATE_KEY : True }
126114 config = {"api_key" : "test_key" }
115+ catalog = build_catalog ("test_stream" )
116+ state = []
127117
128- build_source (manifest , config )
118+ build_source (manifest , catalog , config , state )
129119
130120 # Verify migrate_manifest is True
131121 call_args = mock_source_class .call_args [1 ]
0 commit comments