diff options
Diffstat (limited to 'tests/qc_app/test_uploads_with_zip_files.py')
-rw-r--r-- | tests/qc_app/test_uploads_with_zip_files.py | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/tests/qc_app/test_uploads_with_zip_files.py b/tests/qc_app/test_uploads_with_zip_files.py index fb101ad..1506cfa 100644 --- a/tests/qc_app/test_uploads_with_zip_files.py +++ b/tests/qc_app/test_uploads_with_zip_files.py @@ -8,10 +8,17 @@ def test_upload_zipfile_with_zero_files(client): THEN: Ensure that the system responds with the appropriate error message and status code """ - resp = client.post("/", data={ - "filetype": "average", - "qc_text_file": uploadable_file_object("empty.zip")}) - assert resp.status_code == 400 + 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 @@ -22,10 +29,18 @@ def test_upload_zipfile_with_multiple_files(client): THEN: Ensure that the system responds with the appropriate error message and status code """ - resp = client.post("/", data={ - "filetype": "average", - "qc_text_file": uploadable_file_object("multiple_files.zip")}) - assert resp.status_code == 400 + 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 @@ -35,7 +50,7 @@ def test_upload_zipfile_with_one_tsv_file(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("/", data={ + resp = client.post("/upload", data={ "speciesid": 1, "filetype": "average", "qc_text_file": uploadable_file_object("average.tsv.zip")}) @@ -53,9 +68,17 @@ def test_upload_zipfile_with_one_non_tsv_file(client): THEN: Ensure that the system responds with the appropriate error message and status code """ - resp = client.post("/", data={ - "filetype": "average", - "qc_text_file": uploadable_file_object("non_tsv.zip")}) - assert resp.status_code == 400 + 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 |