aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-04-08 10:32:10 +0300
committerFrederick Muriuki Muriithi2024-04-08 10:32:10 +0300
commit619bf2e80dd6c225a4121507f0b9374598b94ea6 (patch)
treecc473938d499435e6d37393b1b82e3b9acde2ab8
parentd5833b207185597d63bbc5ff2b0cc0df6df4ab69 (diff)
downloadgn-uploader-619bf2e80dd6c225a4121507f0b9374598b94ea6.tar.gz
Fix issues caught by integration tests.
-rw-r--r--qc_app/parse.py14
-rw-r--r--qc_app/templates/index.html2
-rw-r--r--tests/conftest.py8
-rw-r--r--tests/qc_app/test_parse.py19
4 files changed, 19 insertions, 24 deletions
diff --git a/qc_app/parse.py b/qc_app/parse.py
index ba2e63e..d20f6f0 100644
--- a/qc_app/parse.py
+++ b/qc_app/parse.py
@@ -30,7 +30,7 @@ def parse():
filename = request.args.get("filename")
filetype = request.args.get("filetype")
if speciesid is None:
- flash("No species selected", "alert-error alert-expr-data-error")
+ flash("No species selected", "alert-error error-expr-data")
errors = True
else:
try:
@@ -38,30 +38,30 @@ def parse():
species = with_db_connection(
lambda con: species_by_id(con, speciesid))
if not bool(species):
- flash("No such species.", "alert-error alert-expr-data-error")
+ flash("No such species.", "alert-error error-expr-data")
errors = True
except ValueError:
flash("Invalid speciesid provided. Expected an integer.",
- "alert-error alert-expr-data-error")
+ "alert-error error-expr-data")
errors = True
if filename is None:
- flash("No file provided", "alert-error alert-expr-data-error")
+ flash("No file provided", "alert-error error-expr-data")
errors = True
if filetype is None:
- flash("No filetype provided", "alert-error alert-expr-data-error")
+ flash("No filetype provided", "alert-error error-expr-data")
errors = True
if filetype not in ("average", "standard-error"):
- flash("Invalid filetype provided", "alert-error alert-expr-data-error")
+ flash("Invalid filetype provided", "alert-error error-expr-data")
errors = True
if filename:
filepath = os.path.join(app.config["UPLOAD_FOLDER"], filename)
if not os.path.exists(filepath):
flash("Selected file does not exist (any longer)",
- "alert-error alert-expr-data-error")
+ "alert-error error-expr-data")
errors = True
if errors:
diff --git a/qc_app/templates/index.html b/qc_app/templates/index.html
index b87a67f..588133a 100644
--- a/qc_app/templates/index.html
+++ b/qc_app/templates/index.html
@@ -59,7 +59,7 @@
enctype="multipart/form-data"
id="frm-upload-expression-data">
<legend class="heading">upload expression data</legend>
- {{flash_messages("error-expr-data-error")}}
+ {{flash_messages("error-expr-data")}}
<fieldset>
<label for="select_species01">Species</label>
diff --git a/tests/conftest.py b/tests/conftest.py
index e4bebc6..a39acf0 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -135,8 +135,8 @@ def redis_conn_with_in_progress_job_some_errors(redis_url, redis_ttl, jobs_prefi
"status": "Processing", "filename": "/path/to/some/file.tsv",
"percent": 45.34245, "errors": jsonpickle.encode((
DuplicateHeading(
- 1, (5,13,19), "DupHead", "Heading 'DupHead' is repeated"),
- InvalidValue(45, 2, "ohMy", "Invalid value 'ohMy'")))}
+ "__test__", 1, (5,13,19), "DupHead", "Heading 'DupHead' is repeated"),
+ InvalidValue("__test__", 45, 2, "ohMy", "Invalid value 'ohMy'")))}
}
with redis.Redis.from_url(redis_url, decode_responses=True) as rconn:
jobs.initialise_job(rconn, **the_job)
@@ -167,8 +167,8 @@ def redis_conn_with_completed_job_some_errors(redis_url, redis_ttl, jobs_prefix,
"status": "success", "filename": "/path/to/some/file.tsv",
"percent": 100, "errors": jsonpickle.encode((
DuplicateHeading(
- 1, (5,13,19), "DupHead", "Heading 'DupHead' is repeated"),
- InvalidValue(45, 2, "ohMy", "Invalid value 'ohMy'")))}}
+ "__test__", 1, (5,13,19), "DupHead", "Heading 'DupHead' is repeated"),
+ InvalidValue("__test__", 45, 2, "ohMy", "Invalid value 'ohMy'")))}}
with redis.Redis.from_url(redis_url, decode_responses=True) as rconn:
jobs.initialise_job(rconn, **the_job)
yield rconn
diff --git a/tests/qc_app/test_parse.py b/tests/qc_app/test_parse.py
index 5e55688..187af76 100644
--- a/tests/qc_app/test_parse.py
+++ b/tests/qc_app/test_parse.py
@@ -55,26 +55,21 @@ def test_parse_with_existing_uploaded_file(#pylint: disable=[too-many-arguments]
"filename,uri,error_msgs",
(("non_existent.file",
"/parse/parse?filename=non_existent.file&filename=average",
- [(b'<span class="alert alert-error">Selected file does not exist '
- b'(any longer)</span>')]),
+ [b'Selected file does not exist (any longer)']),
("non_existent.file",
"/parse/parse?filename=non_existent.file&filename=standard-error",
- [(b'<span class="alert alert-error">Selected file does not exist '
- b'(any longer)</span>')]),
+ [b'Selected file does not exist (any longer)']),
("non_existent.file",
"/parse/parse?filename=non_existent.file&filename=percival",
- [(b'<span class="alert alert-error">Selected file does not exist '
- b'(any longer)</span>'),
- b'<span class="alert alert-error">Invalid filetype provided</span>']),
+ [b'Selected file does not exist (any longer)',
+ b'Invalid filetype provided']),
("no_data_errors.tsv",
"/parse/parse?filename=no_data_errors.tsv&filename=percival",
- [b'<span class="alert alert-error">Invalid filetype provided</span>']),
+ [b'Invalid filetype provided']),
("no_data_errors.tsv",
"/parse/parse?filename=no_data_errors.tsv",
- [b'<span class="alert alert-error">No filetype provided</span>']),
- (None, "/parse/parse",
- [b'<span class="alert alert-error">No file provided</span>',
- b'<span class="alert alert-error">No filetype provided</span>'])))
+ [b'No filetype provided']),
+ (None, "/parse/parse", [b'No file provided', b'No filetype provided'])))
def test_parse_with_non_uploaded_file(client, filename, uri, error_msgs):
"""
GIVEN: 1. A flask application testing client