1- # Copyright 2024 The MathWorks, Inc.
1+ # Copyright 2024-2025 The MathWorks, Inc.
22import pytest
33
44from matlab_proxy .util .mwi .download import (
@@ -20,12 +20,6 @@ def mock_request_fixture(mocker):
2020 return mock_req
2121
2222
23- def _get_expected_output_based_on_os_type (paths : list ) -> str :
24- import matlab_proxy .util .system as system
25-
26- return "\\ " .join (paths ) if system .is_windows () else "/" .join (paths )
27-
28-
2923# Test for is_download_request function
3024@pytest .mark .parametrize (
3125 "test_base_url, path, expected" ,
@@ -70,26 +64,25 @@ def test_is_download_request(mock_request_fixture, test_base_url, path, expected
7064 False ,
7165 "" ,
7266 "/download/some/path/to/file.txt" ,
73- _get_expected_output_based_on_os_type ([ "/some" , " path" , "to" , " file.txt"]) ,
67+ "/some/ path/to/ file.txt" ,
7468 ),
7569 (
7670 False ,
7771 "/base" ,
7872 "/base/download/some/path/to/file.txt" ,
79- _get_expected_output_based_on_os_type ([ "/some" , " path" , "to" , " file.txt"]) ,
73+ "/some/ path/to/ file.txt" ,
8074 ),
8175 ],
8276 ids = [
83- "Windows with null base url" ,
84- "Windows with non-null base url" ,
85- "Linux with null base url" ,
86- "Linux with non-null base url" ,
77+ "Windows path with null base url" ,
78+ "Windows path with non-null base url" ,
79+ "Linux path with null base url" ,
80+ "Linux path with non-null base url" ,
8781 ],
8882)
8983def test_get_download_payload_path (
9084 mock_request_fixture , mocker , is_windows , test_base_url , path , expected
9185):
92- mocker .patch ("matlab_proxy.util.system.is_windows" , return_value = is_windows )
9386 mock_request_fixture .app ["settings" ]["base_url" ] = test_base_url
9487 mock_request_fixture .rel_url .path = path
9588 assert _get_download_payload_path (mock_request_fixture ) == expected
0 commit comments