mirror of
https://github.com/akuker/RASCSI.git
synced 2025-02-18 01:31:02 +00:00
Added tests for extracting .sit and .7z archive formats
This commit is contained in:
parent
65c2286ffe
commit
663de0631e
@ -443,14 +443,19 @@ def test_delete_file(http_client, create_test_image, list_files):
|
|||||||
|
|
||||||
|
|
||||||
# route("/files/extract_image", methods=["POST"])
|
# route("/files/extract_image", methods=["POST"])
|
||||||
# TODO: Add test files for all supported formats
|
@pytest.mark.parametrize(
|
||||||
def test_extract_file(httpserver, http_client, list_files, delete_file):
|
"archive_file_name,image_file_name",
|
||||||
image_file_name = "test_image.hds"
|
[
|
||||||
zip_file_name = "test_image.hds.zip"
|
("test_image.zip", "test_image_from_zip.hds"),
|
||||||
http_path = f"/images/{zip_file_name}"
|
("test_image.sit", "test_image_from_sit.hds"),
|
||||||
|
("test_image.7z", "test_image_from_7z.hds"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_extract_file(httpserver, http_client, list_files, delete_file, archive_file_name, image_file_name):
|
||||||
|
http_path = f"/images/{archive_file_name}"
|
||||||
url = httpserver.url_for(http_path)
|
url = httpserver.url_for(http_path)
|
||||||
|
|
||||||
with open(f"tests/assets/{zip_file_name}", mode="rb") as file:
|
with open(f"tests/assets/{archive_file_name}", mode="rb") as file:
|
||||||
zip_file_data = file.read()
|
zip_file_data = file.read()
|
||||||
|
|
||||||
httpserver.expect_request(http_path).respond_with_data(
|
httpserver.expect_request(http_path).respond_with_data(
|
||||||
@ -468,7 +473,7 @@ def test_extract_file(httpserver, http_client, list_files, delete_file):
|
|||||||
response = http_client.post(
|
response = http_client.post(
|
||||||
"/files/extract_image",
|
"/files/extract_image",
|
||||||
data={
|
data={
|
||||||
"archive_file": zip_file_name,
|
"archive_file": archive_file_name,
|
||||||
"archive_members": image_file_name,
|
"archive_members": image_file_name,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -481,7 +486,7 @@ def test_extract_file(httpserver, http_client, list_files, delete_file):
|
|||||||
assert image_file_name in list_files()
|
assert image_file_name in list_files()
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
delete_file(zip_file_name)
|
delete_file(archive_file_name)
|
||||||
delete_file(image_file_name)
|
delete_file(image_file_name)
|
||||||
|
|
||||||
|
|
||||||
|
BIN
python/web/tests/assets/test_image.7z
Normal file
BIN
python/web/tests/assets/test_image.7z
Normal file
Binary file not shown.
BIN
python/web/tests/assets/test_image.sit
Normal file
BIN
python/web/tests/assets/test_image.sit
Normal file
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user