WebUI: Traverse target dir to get subdirs to download/upload to (#1115)

This commit is contained in:
Daniel Markstedt
2023-03-04 16:57:32 -08:00
committed by GitHub
parent 3de66af55c
commit 5fd0dc420b
5 changed files with 81 additions and 21 deletions

View File

@@ -207,7 +207,8 @@ def test_extract_file(
http_client.post(
"/files/download_url",
data={
"destination": "images",
"destination": "disk_images",
"images_subdir": "/",
"url": url,
},
)
@@ -254,7 +255,7 @@ def test_upload_file(http_client, delete_file):
form_data = {
"destination": "disk_images",
"subdir": "",
"images_subdir": "/",
"dzuuid": str(uuid.uuid4()),
"dzchunkindex": chunk_number,
"dzchunksize": chunk_size,
@@ -334,6 +335,7 @@ def test_download_properties(http_client, list_files, delete_file):
def test_download_url_to_dir(env, httpserver, http_client, list_files, delete_file):
file_name = str(uuid.uuid4())
http_path = f"/images/{file_name}"
subdir = "/"
url = httpserver.url_for(http_path)
with open("tests/assets/test_image.hds", mode="rb") as file:
@@ -347,7 +349,8 @@ def test_download_url_to_dir(env, httpserver, http_client, list_files, delete_fi
response = http_client.post(
"/files/download_url",
data={
"destination": "images",
"destination": "disk_images",
"images_subdir": subdir,
"url": url,
},
)
@@ -358,7 +361,8 @@ def test_download_url_to_dir(env, httpserver, http_client, list_files, delete_fi
assert response_data["status"] == STATUS_SUCCESS
assert file_name in list_files()
assert (
response_data["messages"][0]["message"] == f"{file_name} downloaded to {env['images_dir']}"
response_data["messages"][0]["message"]
== f"{file_name} downloaded to {env['images_dir']}{subdir}"
)
# Cleanup