aboutsummaryrefslogtreecommitdiff
path: root/tests/qc_app/test_uploads_with_zip_files.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/qc_app/test_uploads_with_zip_files.py')
-rw-r--r--tests/qc_app/test_uploads_with_zip_files.py84
1 files changed, 0 insertions, 84 deletions
diff --git a/tests/qc_app/test_uploads_with_zip_files.py b/tests/qc_app/test_uploads_with_zip_files.py
deleted file mode 100644
index 1506cfa..0000000
--- a/tests/qc_app/test_uploads_with_zip_files.py
+++ /dev/null
@@ -1,84 +0,0 @@
-"""Test the upload of zip files"""
-from tests.conftest import uploadable_file_object
-
-def test_upload_zipfile_with_zero_files(client):
- """
- GIVEN: A flask application testing client
- WHEN: A zip file with no files is uploaded
- THEN: Ensure that the system responds with the appropriate error message and
- status code
- """
- resp = client.post("/upload",
- data={
- "filetype": "average",
- "qc_text_file": uploadable_file_object("empty.zip")},
- follow_redirects=True)
- assert len(resp.history) == 1
- redirect = resp.history[0]
- assert redirect.status_code == 302
- assert redirect.location == "/upload"
-
- assert resp.status_code == 200
- assert (b"Expected exactly one (1) member file within the uploaded zip "
- b"file. Got 0 member files.") in resp.data
-
-def test_upload_zipfile_with_multiple_files(client):
- """
- GIVEN: A flask application testing client
- WHEN: A zip file with more than one file is uploaded
- THEN: Ensure that the system responds with the appropriate error message and
- status code
- """
- resp = client.post(
- "/upload",
- data={
- "filetype": "average",
- "qc_text_file": uploadable_file_object("multiple_files.zip")},
- follow_redirects=True)
- assert len(resp.history) == 1
- redirect = resp.history[0]
- assert redirect.status_code == 302
- assert redirect.location == "/upload"
-
- assert resp.status_code == 200
- assert (b"Expected exactly one (1) member file within the uploaded zip "
- b"file. Got 3 member files.") in resp.data
-
-def test_upload_zipfile_with_one_tsv_file(client):
- """
- GIVEN: A flask application testing client
- WHEN: A zip file with exactly one valid TSV file is uploaded
- THEN: Ensure that the system redirects to the correct next URL
- """
- resp = client.post("/upload", data={
- "speciesid": 1,
- "filetype": "average",
- "qc_text_file": uploadable_file_object("average.tsv.zip")})
- assert resp.status_code == 302
- assert b"Redirecting..." in resp.data
- assert (
- b"/parse/parse?speciesid=1&filename=average.tsv.zip&filetype=average"
- in resp.data)
-
-def test_upload_zipfile_with_one_non_tsv_file(client):
- """
- GIVEN: A flask application testing client
- WHEN: A zip file with exactly one file, which is not a valid TSV, is
- uploaded
- THEN: Ensure that the system responds with the appropriate error message and
- status code
- """
- resp = client.post(
- "/upload",
- data={
- "filetype": "average",
- "qc_text_file": uploadable_file_object("non_tsv.zip")},
- follow_redirects=True)
- assert len(resp.history) == 1
- redirect = resp.history[0]
- assert redirect.status_code == 302
- assert redirect.location == "/upload"
-
- assert resp.status_code == 200
- assert (b"Expected the member text file in the uploaded zip file to "
- b"be a tab-separated file.") in resp.data