diff options
Diffstat (limited to 'tests/qc_app/test_parse.py')
-rw-r--r-- | tests/qc_app/test_parse.py | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/tests/qc_app/test_parse.py b/tests/qc_app/test_parse.py index f173e0a..5e55688 100644 --- a/tests/qc_app/test_parse.py +++ b/tests/qc_app/test_parse.py @@ -4,11 +4,18 @@ import sys import redis import pytest -from qc_app.jobs import job +from qc_app.jobs import job, jobsnamespace + from tests.conftest import uploadable_file_object -def test_parse_with_existing_uploaded_file( - client, redis_url, job_id, monkeypatch): +def test_parse_with_existing_uploaded_file(#pylint: disable=[too-many-arguments] + client, + db_url, + redis_url, + redis_ttl, + jobs_prefix, + job_id, + monkeypatch): """ GIVEN: 1. A flask application testing client 2. A valid file, and filetype @@ -19,27 +26,30 @@ def test_parse_with_existing_uploaded_file( """ monkeypatch.setattr("qc_app.jobs.uuid4", lambda : job_id) # Upload a file + speciesid = 1 filename = "no_data_errors.tsv" filetype = "average" client.post( "/", data={ + "speciesid": speciesid, "filetype": filetype, "qc_text_file": uploadable_file_object(filename)}) # Checks - resp = client.get(f"/parse/parse?filename={filename}&filetype={filetype}") + resp = client.get(f"/parse/parse?speciesid={speciesid}&filename={filename}" + f"&filetype={filetype}") assert resp.status_code == 302 assert b'Redirecting...' in resp.data assert b'/parse/status/934c55d8-396e-4959-90e1-2698e9205758' in resp.data with redis.Redis.from_url(redis_url, decode_responses=True) as rconn: - the_job = job(rconn, job_id) + the_job = job(rconn, jobsnamespace(), job_id) - assert the_job["job_id"] == job_id + assert the_job["jobid"] == job_id assert the_job["filename"] == filename assert the_job["command"] == " ".join([ - sys.executable, "-m", "scripts.validate_file", filetype, - f"{client.application.config['UPLOAD_FOLDER']}/{filename}", redis_url, - job_id]) + sys.executable, "-m", "scripts.validate_file", db_url, redis_url, + jobs_prefix, job_id, "--redisexpiry", str(redis_ttl), str(speciesid), + filetype, f"{client.application.config['UPLOAD_FOLDER']}/{filename}"]) @pytest.mark.parametrize( "filename,uri,error_msgs", |