33import pytest
44from rich .progress import Progress
55from dvuploader .directupload import (
6- _add_file_to_ds ,
76 UPLOAD_ENDPOINT ,
87 REPLACE_ENDPOINT ,
8+ _add_files_to_ds ,
99 _validate_ticket_response ,
1010)
1111
@@ -25,16 +25,16 @@ async def test_successfully_add_file_with_valid_filepath(self, mocker):
2525 dataverse_url = "https://example.com"
2626 pid = "persistent_id"
2727 fpath = "tests/fixtures/add_dir_files/somefile.txt"
28- file = File (filepath = fpath )
28+ files = [ File (filepath = fpath )]
2929 progress = Progress ()
3030 pbar = progress .add_task ("Uploading" , total = 1 )
3131
3232 # Invoke the function
33- result = await _add_file_to_ds (
33+ await _add_files_to_ds (
3434 session = session ,
3535 dataverse_url = dataverse_url ,
3636 pid = pid ,
37- file = file ,
37+ files = files ,
3838 progress = progress ,
3939 pbar = pbar ,
4040 )
@@ -55,23 +55,23 @@ async def test_successfully_replace_file_with_valid_filepath(self, mocker):
5555 dataverse_url = "https://example.com"
5656 pid = "persistent_id"
5757 fpath = "tests/fixtures/add_dir_files/somefile.txt"
58- file = File (filepath = fpath , file_id = "0" )
58+ files = [ File (filepath = fpath , file_id = "0" )]
5959 progress = Progress ()
6060 pbar = progress .add_task ("Uploading" , total = 1 )
6161
6262 # Invoke the function
63- result = await _add_file_to_ds (
63+ await _add_files_to_ds (
6464 session = session ,
6565 dataverse_url = dataverse_url ,
6666 pid = pid ,
67- file = file ,
67+ files = files ,
6868 progress = progress ,
6969 pbar = pbar ,
7070 )
7171
7272 # Assert that the response status is 200 and the result is True
7373 assert mock_post .called_with (
74- urljoin (dataverse_url , REPLACE_ENDPOINT . format ( FILE_ID = file . file_id ) ),
74+ urljoin (dataverse_url , REPLACE_ENDPOINT + pid ),
7575 data = mocker .ANY ,
7676 )
7777
0 commit comments