@@ -202,7 +202,11 @@ def test_create(self, mock_client: Mock, object_view: MockObjectView) -> None:
202202 assert isinstance (obj , StorageObject )
203203 assert obj .id == "obj_123"
204204 assert obj .upload_url == "https://upload.example.com/obj_123"
205- mock_client .objects .create .assert_called_once ()
205+ mock_client .objects .create .assert_called_once_with (
206+ name = "test.txt" ,
207+ content_type = "text" ,
208+ metadata = {"key" : "value" },
209+ )
206210
207211 def test_from_id (self , mock_client : Mock ) -> None :
208212 """Test from_id method."""
@@ -231,7 +235,14 @@ def test_list(self, mock_client: Mock, object_view: MockObjectView) -> None:
231235 assert len (objects ) == 1
232236 assert isinstance (objects [0 ], StorageObject )
233237 assert objects [0 ].id == "obj_123"
234- mock_client .objects .list .assert_called_once ()
238+ mock_client .objects .list .assert_called_once_with (
239+ content_type = "text" ,
240+ limit = 10 ,
241+ name = "test" ,
242+ search = "query" ,
243+ starting_after = "obj_000" ,
244+ state = "READ_ONLY" ,
245+ )
235246
236247 def test_upload_from_file (self , mock_client : Mock , object_view : MockObjectView , tmp_path : Path ) -> None :
237248 """Test upload_from_file method."""
@@ -250,9 +261,14 @@ def test_upload_from_file(self, mock_client: Mock, object_view: MockObjectView,
250261
251262 assert isinstance (obj , StorageObject )
252263 assert obj .id == "obj_123"
253- mock_client .objects .create .assert_called_once ()
254- mock_client .objects .complete .assert_called_once ()
264+ mock_client .objects .create .assert_called_once_with (
265+ name = "test.txt" ,
266+ content_type = "text" ,
267+ metadata = None ,
268+ ttl_ms = None ,
269+ )
255270 http_client .put .assert_called_once_with (object_view .upload_url , content = b"test content" )
271+ mock_client .objects .complete .assert_called_once ()
256272
257273 def test_upload_from_text (self , mock_client : Mock , object_view : MockObjectView ) -> None :
258274 """Test upload_from_text method."""
@@ -272,6 +288,7 @@ def test_upload_from_text(self, mock_client: Mock, object_view: MockObjectView)
272288 name = "test.txt" ,
273289 content_type = "text" ,
274290 metadata = {"key" : "value" },
291+ ttl_ms = None ,
275292 )
276293 http_client .put .assert_called_once_with (object_view .upload_url , content = "test content" )
277294 mock_client .objects .complete .assert_called_once ()
@@ -294,6 +311,7 @@ def test_upload_from_bytes(self, mock_client: Mock, object_view: MockObjectView)
294311 name = "test.bin" ,
295312 content_type = "binary" ,
296313 metadata = None ,
314+ ttl_ms = None ,
297315 )
298316 http_client .put .assert_called_once_with (object_view .upload_url , content = b"test content" )
299317 mock_client .objects .complete .assert_called_once ()
@@ -362,10 +380,12 @@ def test_upload_from_dir_default_name(self, mock_client: Mock, object_view: Mock
362380
363381 assert isinstance (obj , StorageObject )
364382 # Name should be directory name + .tar.gz
365- mock_client .objects .create .assert_called_once ()
366- call_args = mock_client .objects .create .call_args
367- assert call_args [1 ]["name" ] == "my_folder.tar.gz"
368- assert call_args [1 ]["content_type" ] == "tgz"
383+ mock_client .objects .create .assert_called_once_with (
384+ name = "my_folder.tar.gz" ,
385+ content_type = "tgz" ,
386+ metadata = None ,
387+ ttl_ms = None ,
388+ )
369389
370390 def test_upload_from_dir_with_ttl (self , mock_client : Mock , object_view : MockObjectView , tmp_path : Path ) -> None :
371391 """Test upload_from_dir with TTL."""
@@ -386,10 +406,12 @@ def test_upload_from_dir_with_ttl(self, mock_client: Mock, object_view: MockObje
386406 obj = client .upload_from_dir (test_dir , ttl = timedelta (hours = 2 ))
387407
388408 assert isinstance (obj , StorageObject )
389- mock_client .objects .create .assert_called_once ()
390- call_args = mock_client .objects .create .call_args
391- # 2 hours = 7200 seconds = 7200000 milliseconds
392- assert call_args [1 ]["ttl_ms" ] == 7200000
409+ mock_client .objects .create .assert_called_once_with (
410+ name = "temp_dir.tar.gz" ,
411+ content_type = "tgz" ,
412+ metadata = None ,
413+ ttl_ms = 7200000 , # 2 hours = 7200 seconds = 7200000 milliseconds
414+ )
393415
394416 def test_upload_from_dir_empty_directory (
395417 self , mock_client : Mock , object_view : MockObjectView , tmp_path : Path
@@ -410,7 +432,12 @@ def test_upload_from_dir_empty_directory(
410432
411433 assert isinstance (obj , StorageObject )
412434 assert obj .id == "obj_123"
413- mock_client .objects .create .assert_called_once ()
435+ mock_client .objects .create .assert_called_once_with (
436+ name = "empty_dir.tar.gz" ,
437+ content_type = "tgz" ,
438+ metadata = None ,
439+ ttl_ms = None ,
440+ )
414441 http_client .put .assert_called_once ()
415442 mock_client .objects .complete .assert_called_once ()
416443
@@ -435,7 +462,14 @@ def test_upload_from_dir_with_string_path(
435462
436463 assert isinstance (obj , StorageObject )
437464 assert obj .id == "obj_123"
438- mock_client .objects .create .assert_called_once ()
465+ mock_client .objects .create .assert_called_once_with (
466+ name = "string_path_dir.tar.gz" ,
467+ content_type = "tgz" ,
468+ metadata = None ,
469+ ttl_ms = None ,
470+ )
471+ http_client .put .assert_called_once ()
472+ mock_client .objects .complete .assert_called_once ()
439473
440474
441475class TestRunloopSDK :
0 commit comments