@@ -97,7 +97,6 @@ async def test_async_main_cli_action_chunks(monkeypatch):
9797 monkeypatch .setattr (
9898 "vectorcode.main.get_project_config" , AsyncMock (return_value = Config ())
9999 )
100- monkeypatch .setattr ("vectorcode.common.try_server" , AsyncMock (return_value = True ))
101100
102101 return_code = await async_main ()
103102 assert return_code == 0
@@ -141,7 +140,9 @@ async def test_async_main_cli_action_query(monkeypatch):
141140 "vectorcode.main.parse_cli_args" , AsyncMock (return_value = mock_cli_args )
142141 )
143142 mock_final_configs = Config (
144- db_url = "http://test_host:1234" , action = CliAction .query , pipe = False
143+ db_params = {"db_url" : "http://test_host:1234" },
144+ action = CliAction .query ,
145+ pipe = False ,
145146 )
146147 monkeypatch .setattr (
147148 "vectorcode.main.get_project_config" ,
@@ -151,7 +152,6 @@ async def test_async_main_cli_action_query(monkeypatch):
151152 )
152153 ),
153154 )
154- monkeypatch .setattr ("vectorcode.common.try_server" , AsyncMock (return_value = True ))
155155 mock_query = AsyncMock (return_value = 0 )
156156 monkeypatch .setattr ("vectorcode.subcommands.query" , mock_query )
157157
@@ -172,7 +172,9 @@ async def test_async_main_cli_action_vectorise(monkeypatch):
172172 "vectorcode.main.parse_cli_args" , AsyncMock (return_value = mock_cli_args )
173173 )
174174 mock_final_configs = Config (
175- db_url = "http://test_host:1234" , action = CliAction .vectorise , include_hidden = True
175+ db_params = {"db_url" : "http://test_host:1234" },
176+ action = CliAction .vectorise ,
177+ include_hidden = True ,
176178 )
177179 monkeypatch .setattr (
178180 "vectorcode.main.get_project_config" ,
@@ -182,7 +184,6 @@ async def test_async_main_cli_action_vectorise(monkeypatch):
182184 )
183185 ),
184186 )
185- monkeypatch .setattr ("vectorcode.common.try_server" , AsyncMock (return_value = True ))
186187 mock_vectorise = AsyncMock (return_value = 0 )
187188 monkeypatch .setattr ("vectorcode.subcommands.vectorise" , mock_vectorise )
188189
@@ -197,7 +198,9 @@ async def test_async_main_cli_action_drop(monkeypatch):
197198 monkeypatch .setattr (
198199 "vectorcode.main.parse_cli_args" , AsyncMock (return_value = mock_cli_args )
199200 )
200- mock_final_configs = Config (db_url = "http://test_host:1234" , action = CliAction .drop )
201+ mock_final_configs = Config (
202+ db_params = {"db_url" : "http://test_host:1234" }, action = CliAction .drop
203+ )
201204 monkeypatch .setattr (
202205 "vectorcode.main.get_project_config" ,
203206 AsyncMock (
@@ -206,7 +209,6 @@ async def test_async_main_cli_action_drop(monkeypatch):
206209 )
207210 ),
208211 )
209- monkeypatch .setattr ("vectorcode.common.try_server" , AsyncMock (return_value = True ))
210212 mock_drop = AsyncMock (return_value = 0 )
211213 monkeypatch .setattr ("vectorcode.subcommands.drop" , mock_drop )
212214
@@ -221,7 +223,9 @@ async def test_async_main_cli_action_ls(monkeypatch):
221223 monkeypatch .setattr (
222224 "vectorcode.main.parse_cli_args" , AsyncMock (return_value = mock_cli_args )
223225 )
224- mock_final_configs = Config (db_url = "http://test_host:1234" , action = CliAction .ls )
226+ mock_final_configs = Config (
227+ db_params = {"db_url" : "http://test_host:1234" }, action = CliAction .ls
228+ )
225229 monkeypatch .setattr (
226230 "vectorcode.main.get_project_config" ,
227231 AsyncMock (
@@ -230,7 +234,6 @@ async def test_async_main_cli_action_ls(monkeypatch):
230234 )
231235 ),
232236 )
233- monkeypatch .setattr ("vectorcode.common.try_server" , AsyncMock (return_value = True ))
234237 mock_ls = AsyncMock (return_value = 0 )
235238 monkeypatch .setattr ("vectorcode.subcommands.ls" , mock_ls )
236239
@@ -247,6 +250,10 @@ async def test_async_main_cli_action_files(monkeypatch):
247250 monkeypatch .setattr (
248251 "vectorcode.main.parse_cli_args" , AsyncMock (return_value = cli_args )
249252 )
253+ monkeypatch .setattr (
254+ "vectorcode.main.get_project_config" ,
255+ AsyncMock (return_value = MagicMock (merge_from = AsyncMock (return_value = cli_args ))),
256+ )
250257 assert await async_main () == 0
251258 mock_files .assert_called_once ()
252259
@@ -257,7 +264,9 @@ async def test_async_main_cli_action_update(monkeypatch):
257264 monkeypatch .setattr (
258265 "vectorcode.main.parse_cli_args" , AsyncMock (return_value = mock_cli_args )
259266 )
260- mock_final_configs = Config (db_url = "http://test_host:1234" , action = CliAction .update )
267+ mock_final_configs = Config (
268+ db_params = {"db_url" : "http://test_host:1234" }, action = CliAction .update
269+ )
261270 monkeypatch .setattr (
262271 "vectorcode.main.get_project_config" ,
263272 AsyncMock (
@@ -266,7 +275,6 @@ async def test_async_main_cli_action_update(monkeypatch):
266275 )
267276 ),
268277 )
269- monkeypatch .setattr ("vectorcode.common.try_server" , AsyncMock (return_value = True ))
270278 mock_update = AsyncMock (return_value = 0 )
271279 monkeypatch .setattr ("vectorcode.subcommands.update" , mock_update )
272280
@@ -281,7 +289,9 @@ async def test_async_main_cli_action_clean(monkeypatch):
281289 monkeypatch .setattr (
282290 "vectorcode.main.parse_cli_args" , AsyncMock (return_value = mock_cli_args )
283291 )
284- mock_final_configs = Config (db_url = "http://test_host:1234" , action = CliAction .clean )
292+ mock_final_configs = Config (
293+ db_params = {"db_url" : "http://test_host:1234" }, action = CliAction .clean
294+ )
285295 monkeypatch .setattr (
286296 "vectorcode.main.get_project_config" ,
287297 AsyncMock (
@@ -290,7 +300,6 @@ async def test_async_main_cli_action_clean(monkeypatch):
290300 )
291301 ),
292302 )
293- monkeypatch .setattr ("vectorcode.common.try_server" , AsyncMock (return_value = True ))
294303 mock_clean = AsyncMock (return_value = 0 )
295304 monkeypatch .setattr ("vectorcode.subcommands.clean" , mock_clean )
296305
@@ -305,7 +314,9 @@ async def test_async_main_exception_handling(monkeypatch):
305314 monkeypatch .setattr (
306315 "vectorcode.main.parse_cli_args" , AsyncMock (return_value = mock_cli_args )
307316 )
308- mock_final_configs = Config (db_url = "http://test_host:1234" , action = CliAction .query )
317+ mock_final_configs = Config (
318+ db_params = {"db_url" : "http://test_host:1234" }, action = CliAction .query
319+ )
309320 monkeypatch .setattr (
310321 "vectorcode.main.get_project_config" ,
311322 AsyncMock (
@@ -314,7 +325,6 @@ async def test_async_main_exception_handling(monkeypatch):
314325 )
315326 ),
316327 )
317- monkeypatch .setattr ("vectorcode.common.try_server" , AsyncMock (return_value = True ))
318328 mock_query = AsyncMock (side_effect = Exception ("Test Exception" ))
319329 monkeypatch .setattr ("vectorcode.subcommands.query" , mock_query )
320330
0 commit comments