11import json
2+ import click
23import pytest
34from unittest .mock import MagicMock
4- from datetime import datetime
55
66from weaviate_cli .managers .export_manager import ExportManager
77
@@ -55,7 +55,7 @@ def test_create_export_include_and_exclude_raises(
5555 export_manager : ExportManager ,
5656) -> None :
5757 """create_export raises when both include and exclude are specified."""
58- with pytest .raises (Exception ) as exc_info :
58+ with pytest .raises (click . ClickException ) as exc_info :
5959 export_manager .create_export (
6060 export_id = "test" ,
6161 backend = "filesystem" ,
@@ -157,35 +157,19 @@ def test_create_export_passes_none_collections_when_not_specified(
157157 assert call_kwargs ["exclude_collections" ] is None
158158
159159
160- def test_create_export_passes_config_with_path (
160+ def test_create_export_no_extra_kwargs (
161161 export_manager : ExportManager , mock_client_with_export : MagicMock
162162) -> None :
163- """create_export passes ExportConfig when path is set."""
164- export_manager .create_export (
165- export_id = "my-export" ,
166- backend = "s3" ,
167- file_format = "parquet" ,
168- path = "/my/path" ,
169- )
170-
171- call_kwargs = mock_client_with_export .export .create .call_args .kwargs
172- config = call_kwargs ["config" ]
173- assert config is not None
174- assert config .path == "/my/path"
175-
176-
177- def test_create_export_no_config_when_path_none (
178- export_manager : ExportManager , mock_client_with_export : MagicMock
179- ) -> None :
180- """create_export passes config=None when path is not set."""
163+ """create_export does not pass config or path to the client."""
181164 export_manager .create_export (
182165 export_id = "my-export" ,
183166 backend = "filesystem" ,
184167 file_format = "parquet" ,
185168 )
186169
187170 call_kwargs = mock_client_with_export .export .create .call_args .kwargs
188- assert call_kwargs ["config" ] is None
171+ assert "config" not in call_kwargs
172+ assert "path" not in call_kwargs
189173
190174
191175def test_create_export_with_wait (
@@ -240,31 +224,17 @@ def test_get_export_status_json_output(export_manager: ExportManager, capsys) ->
240224def test_get_export_status_passes_correct_args (
241225 export_manager : ExportManager , mock_client_with_export : MagicMock
242226) -> None :
243- """get_export_status passes correct args to client, wrapping path in ExportConfig ."""
227+ """get_export_status passes only export_id and backend to client ."""
244228 export_manager .get_export_status (
245229 export_id = "my-export" ,
246230 backend = "s3" ,
247- path = "/my/path" ,
248231 )
249232
250233 mock_client_with_export .export .get_status .assert_called_once ()
251234 call_kwargs = mock_client_with_export .export .get_status .call_args .kwargs
252235 assert call_kwargs ["export_id" ] == "my-export"
253- assert call_kwargs ["config" ] is not None
254- assert call_kwargs ["config" ].path == "/my/path"
255-
256-
257- def test_get_export_status_no_config_when_path_none (
258- export_manager : ExportManager , mock_client_with_export : MagicMock
259- ) -> None :
260- """get_export_status passes config=None when path is not set."""
261- export_manager .get_export_status (
262- export_id = "my-export" ,
263- backend = "filesystem" ,
264- )
265-
266- call_kwargs = mock_client_with_export .export .get_status .call_args .kwargs
267- assert call_kwargs ["config" ] is None
236+ assert "config" not in call_kwargs
237+ assert "path" not in call_kwargs
268238
269239
270240def test_get_export_status_with_shard_status_json (
@@ -352,31 +322,17 @@ def test_cancel_export_success_json_output(
352322def test_cancel_export_passes_correct_args (
353323 export_manager : ExportManager , mock_client_with_export : MagicMock
354324) -> None :
355- """cancel_export passes correct args to client, wrapping path in ExportConfig ."""
325+ """cancel_export passes only export_id and backend to client ."""
356326 export_manager .cancel_export (
357327 export_id = "my-export" ,
358328 backend = "gcs" ,
359- path = "/my/path" ,
360329 )
361330
362331 mock_client_with_export .export .cancel .assert_called_once ()
363332 call_kwargs = mock_client_with_export .export .cancel .call_args .kwargs
364333 assert call_kwargs ["export_id" ] == "my-export"
365- assert call_kwargs ["config" ] is not None
366- assert call_kwargs ["config" ].path == "/my/path"
367-
368-
369- def test_cancel_export_no_config_when_path_none (
370- export_manager : ExportManager , mock_client_with_export : MagicMock
371- ) -> None :
372- """cancel_export passes config=None when path is not set."""
373- export_manager .cancel_export (
374- export_id = "my-export" ,
375- backend = "filesystem" ,
376- )
377-
378- call_kwargs = mock_client_with_export .export .cancel .call_args .kwargs
379- assert call_kwargs ["config" ] is None
334+ assert "config" not in call_kwargs
335+ assert "path" not in call_kwargs
380336
381337
382338# ---------------------------------------------------------------------------
@@ -390,7 +346,7 @@ def test_cancel_export_failure_raises(
390346 """cancel_export when client returns False raises an exception."""
391347 mock_client_with_export .export .cancel .return_value = False
392348
393- with pytest .raises (Exception ) as exc_info :
349+ with pytest .raises (click . ClickException ) as exc_info :
394350 export_manager .cancel_export (
395351 export_id = "my-export" ,
396352 backend = "filesystem" ,
0 commit comments