Skip to content

Commit

Permalink
Fix DownloadsEndpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
egbertbouman authored and ichorid committed Mar 6, 2020
1 parent 7f4ae89 commit c025f79
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def create_dconfig_from_params(parameters):
download_config.set_dest_dir(dest_dir)

if 'selected_files' in parameters:
download_config.set_selected_files(parameters['selected_files'])
download_config.set_selected_file_indexes(parameters['selected_files'])

return download_config, None

Expand Down Expand Up @@ -434,7 +434,7 @@ async def update_download(self, request):
num_files = len(download.tdef.get_files())
if not all([0 <= index < num_files for index in selected_files_list]):
return RESTResponse({"error": "index out of range"}, status=HTTP_BAD_REQUEST)
download.set_selected_file_indexes(selected_files_list)
download.set_selected_files(selected_files_list)

if parameters.get('state'):
state = parameters['state']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ async def test_select_download_file(self):
def mocked_set_selected_files(*_):
mocked_set_selected_files.called = True
mocked_set_selected_files.called = False
download.set_selected_file_indexes = mocked_set_selected_files
download.set_selected_files = mocked_set_selected_files

await self.do_request(f'downloads/{infohash}', post_data={"selected_files": [0]},
expected_code=200, request_type='PATCH',
Expand Down

0 comments on commit c025f79

Please sign in to comment.