@@ -3303,27 +3303,25 @@ async def test_node_is_file_object_false(
33033303
33043304
33053305@pytest .mark .parametrize ("client_type" , client_types )
3306- async def test_node_select_content_for_upload_with_bytes (
3306+ async def test_node_upload_from_bytes_with_bytes (
33073307 client_type : str , clients : BothClients , file_object_schema : NodeSchemaAPI
33083308) -> None :
3309- """Test that select_content_for_upload works with bytes on FileObject nodes."""
3309+ """Test that upload_from_bytes works with bytes on FileObject nodes."""
33103310 if client_type == "standard" :
33113311 node = InfrahubNode (client = clients .standard , schema = file_object_schema , branch = "main" )
33123312 else :
33133313 node = InfrahubNodeSync (client = clients .sync , schema = file_object_schema , branch = "main" )
33143314
33153315 file_content = b"PDF content here"
3316- node .select_content_for_upload (content = file_content , name = "contract.pdf" )
3316+ node .upload_from_bytes (content = file_content , name = "contract.pdf" )
33173317
33183318 assert node ._file_content == file_content
33193319 assert node ._file_name == "contract.pdf"
33203320
33213321
33223322@pytest .mark .parametrize ("client_type" , client_types )
3323- async def test_node_select_file_for_upload (
3324- client_type : str , clients : BothClients , file_object_schema : NodeSchemaAPI
3325- ) -> None :
3326- """Test that select_file_for_upload works with a Path object."""
3323+ async def test_node_upload_from_path (client_type : str , clients : BothClients , file_object_schema : NodeSchemaAPI ) -> None :
3324+ """Test that upload_from_path works with a Path object."""
33273325 if client_type == "standard" :
33283326 node = InfrahubNode (client = clients .standard , schema = file_object_schema , branch = "main" )
33293327 else :
@@ -3335,16 +3333,16 @@ async def test_node_select_file_for_upload(
33353333 tmp .flush ()
33363334 tmp_path = Path (tmp .name )
33373335
3338- node .select_file_for_upload (path = tmp_path )
3336+ node .upload_from_path (path = tmp_path )
33393337 assert node ._file_content == tmp_path
33403338 assert node ._file_name == tmp_path .name
33413339
33423340
33433341@pytest .mark .parametrize ("client_type" , client_types )
3344- async def test_node_select_content_for_upload_with_binary_io (
3342+ async def test_node_upload_from_bytes_with_binary_io (
33453343 client_type : str , clients : BothClients , file_object_schema : NodeSchemaAPI
33463344) -> None :
3347- """Test that select_content_for_upload works with a BinaryIO object."""
3345+ """Test that upload_from_bytes works with a BinaryIO object."""
33483346 if client_type == "standard" :
33493347 node = InfrahubNode (client = clients .standard , schema = file_object_schema , branch = "main" )
33503348 else :
@@ -3353,38 +3351,38 @@ async def test_node_select_content_for_upload_with_binary_io(
33533351 file_content = b"Content from BinaryIO"
33543352 file_obj = BytesIO (file_content )
33553353
3356- node .select_content_for_upload (content = file_obj , name = "uploaded.pdf" )
3354+ node .upload_from_bytes (content = file_obj , name = "uploaded.pdf" )
33573355
33583356 assert node ._file_content == file_obj
33593357 assert node ._file_name == "uploaded.pdf"
33603358
33613359
33623360@pytest .mark .parametrize ("client_type" , client_types )
3363- async def test_node_select_content_for_upload_on_non_file_object_raises (
3361+ async def test_node_upload_from_bytes_on_non_file_object_raises (
33643362 client_type : str , clients : BothClients , non_file_object_schema : NodeSchemaAPI
33653363) -> None :
3366- """Test that select_content_for_upload raises FeatureNotSupportedError on non-FileObject nodes."""
3364+ """Test that upload_from_bytes raises FeatureNotSupportedError on non-FileObject nodes."""
33673365 if client_type == "standard" :
33683366 node = InfrahubNode (client = clients .standard , schema = non_file_object_schema , branch = "main" )
33693367 else :
33703368 node = InfrahubNodeSync (client = clients .sync , schema = non_file_object_schema , branch = "main" )
33713369
33723370 with pytest .raises (FeatureNotSupportedError , match = r"File upload is not supported" ):
3373- node .select_content_for_upload (content = b"some content" , name = "file.txt" )
3371+ node .upload_from_bytes (content = b"some content" , name = "file.txt" )
33743372
33753373
33763374@pytest .mark .parametrize ("client_type" , client_types )
3377- async def test_node_select_file_for_upload_on_non_file_object_raises (
3375+ async def test_node_upload_from_path_on_non_file_object_raises (
33783376 client_type : str , clients : BothClients , non_file_object_schema : NodeSchemaAPI
33793377) -> None :
3380- """Test that select_file_for_upload raises FeatureNotSupportedError on non-FileObject nodes."""
3378+ """Test that upload_from_path raises FeatureNotSupportedError on non-FileObject nodes."""
33813379 if client_type == "standard" :
33823380 node = InfrahubNode (client = clients .standard , schema = non_file_object_schema , branch = "main" )
33833381 else :
33843382 node = InfrahubNodeSync (client = clients .sync , schema = non_file_object_schema , branch = "main" )
33853383
33863384 with pytest .raises (FeatureNotSupportedError , match = r"File upload is not supported" ):
3387- node .select_file_for_upload (path = Path ("/some/file.txt" ))
3385+ node .upload_from_path (path = Path ("/some/file.txt" ))
33883386
33893387
33903388@pytest .mark .parametrize ("client_type" , client_types )
@@ -3398,7 +3396,7 @@ async def test_node_clear_file(client_type: str, clients: BothClients, file_obje
33983396 file_content = b"Test content"
33993397 file_name = "file.txt"
34003398
3401- node .select_content_for_upload (content = file_content , name = file_name )
3399+ node .upload_from_bytes (content = file_content , name = file_name )
34023400 assert node ._file_content == file_content
34033401 assert node ._file_name == file_name
34043402
@@ -3419,7 +3417,7 @@ async def test_node_get_file_for_upload_bytes(
34193417
34203418 file_content = b"Test content"
34213419 file_name = "test.txt"
3422- node .select_content_for_upload (content = file_content , name = file_name )
3420+ node .upload_from_bytes (content = file_content , name = file_name )
34233421
34243422 if isinstance (node , InfrahubNode ):
34253423 prepared = await node ._get_file_for_upload ()
@@ -3448,7 +3446,7 @@ async def test_node_get_file_for_upload_path(
34483446 tmp .flush ()
34493447 tmp_path = Path (tmp .name )
34503448
3451- node .select_file_for_upload (path = tmp_path )
3449+ node .upload_from_path (path = tmp_path )
34523450
34533451 if isinstance (node , InfrahubNode ):
34543452 prepared = await node ._get_file_for_upload ()
@@ -3475,7 +3473,7 @@ async def test_node_get_file_for_upload_binary_io(
34753473 file_content = b"Content from BinaryIO"
34763474 file_name = "test.bin"
34773475 file_obj_input = BytesIO (file_content )
3478- node .select_content_for_upload (content = file_obj_input , name = file_name )
3476+ node .upload_from_bytes (content = file_obj_input , name = file_name )
34793477
34803478 if isinstance (node , InfrahubNode ):
34813479 prepared = await node ._get_file_for_upload ()
@@ -3517,7 +3515,7 @@ async def test_node_generate_input_data_with_file(
35173515 else :
35183516 node = InfrahubNodeSync (client = clients .sync , schema = file_object_schema , branch = "main" )
35193517
3520- node .select_content_for_upload (content = b"test content" , name = "test.txt" )
3518+ node .upload_from_bytes (content = b"test content" , name = "test.txt" )
35213519
35223520 input_data = node ._generate_input_data ()
35233521
0 commit comments