From 7a286d3a3c5c4d6c6838e03b109abc46aa508f38 Mon Sep 17 00:00:00 2001 From: burnout87 Date: Tue, 19 Nov 2024 13:36:29 +0100 Subject: [PATCH] tests adapted --- tests/test_server_basic.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/tests/test_server_basic.py b/tests/test_server_basic.py index 94f8b3fc..6f78ab6e 100644 --- a/tests/test_server_basic.py +++ b/tests/test_server_basic.py @@ -1714,24 +1714,18 @@ def test_arg_file(dispatcher_live_fixture, dispatcher_test_conf, public_download file_hash = make_hash_file(p_file_path) dpars = urlencode(dict(file_list=file_hash, _is_mmoda_url=True, - return_archive=False, - token=encoded_token)) + return_archive=False)) local_download_url = f"{os.path.join(products_host_port, 'download_file')}?{dpars}" assert arg_download_url == local_download_url if public_download_request: - url_parts = urlparse(arg_download_url) - url_args = parse_qs(url_parts.query) - del url_args['token'] - new_url_parts = url_parts._replace(query=urlencode(url_args, doseq=True)) - arg_download_url = urlunparse(new_url_parts) c = requests.get(arg_download_url) assert c.status_code == 403 jdata = c.json() assert jdata['exit_status']['message'] == "User cannot access the file" else: - # arg_download_url += f'&token={encoded_token}' + arg_download_url += f'&token={encoded_token}' c = requests.get(arg_download_url) assert c.status_code == 200 with open(p_file_path) as p_file: @@ -1793,8 +1787,7 @@ def test_arg_file_external_product_url(dispatcher_live_fixture_with_external_pro file_hash = make_hash_file(p_file_path) dpars = urlencode(dict(file_list=file_hash, _is_mmoda_url=True, - return_archive=False, - token=encoded_token)) + return_archive=False)) local_download_url = f"{os.path.join(dispatcher_test_conf_with_external_products_url['products_url'], 'dispatch-data/download_file')}?{dpars}" assert jdata['products']['analysis_parameters']['dummy_file'] == local_download_url @@ -1854,8 +1847,7 @@ def test_arg_file_default_product_url(dispatcher_live_fixture_with_default_route file_hash = make_hash_file(p_file_path) dpars = urlencode(dict(file_list=file_hash, _is_mmoda_url=True, - return_archive=False, - token=encoded_token)) + return_archive=False)) local_download_url = f"{os.path.join(dispatcher_test_conf_with_default_route_products_url['products_url'], 'dispatch-data/download_file')}?{dpars}" assert jdata['products']['analysis_parameters']['dummy_file'] == local_download_url