aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-10-05 11:02:37 +0300
committerFrederick Muriuki Muriithi2022-10-05 11:02:37 +0300
commit163f43a1eebfea7b97f7b30e9e2a036aeebfe658 (patch)
tree7b02e264224f0d396e6463275ae310a7c0e739a5
parent13289325fb22c4bc10b52414fb9755e7911795f3 (diff)
downloadgenenetwork2-163f43a1eebfea7b97f7b30e9e2a036aeebfe658.tar.gz
mechanical-rob: Fix tests that were checking for the wrong thing
-rw-r--r--test/requests/correlation_tests.py31
1 files changed, 25 insertions, 6 deletions
diff --git a/test/requests/correlation_tests.py b/test/requests/correlation_tests.py
index 9d106013..0915dc68 100644
--- a/test/requests/correlation_tests.py
+++ b/test/requests/correlation_tests.py
@@ -1,4 +1,5 @@
import sys
+import html
import requests
from lxml.html import parse
from link_checker import check_page
@@ -58,11 +59,20 @@ def check_tissue_correlations(baseurl, base_data):
"corr_type": "tissue",
"location_type": "gene",
}
- top_n_message = "The top 100 correlations ranked by the Tissue Correlation"
result = do_request(f"{baseurl}/corr_compute", data)
+
assert result.status_code == 200
- assert (result.text.find(f"Values of record {base_data['trait_id']}") >= 0), result.text
- assert (result.text.find(top_n_message) >= 0), result.text
+ if (data["trait_id"] == "1442370_at"
+ and data["corr_dataset"] in ("BXDPublish",)):
+ top_n_message = (
+ "It is not possible to compute the 'Tissue' correlations between "
+ f"trait '{data['trait_id']}' and the data")
+ else:
+ top_n_message = "The top 100 correlations ranked by the Tissue Correlation"
+ assert (result.text.find(f"Values of record {base_data['trait_id']}") >= 0), result.text
+
+ assert (html.unescape(result.text).find(top_n_message) >= 0), (
+ f"NOT FOUND: {top_n_message}")
def check_lit_correlations(baseurl, base_data):
data = {
@@ -70,11 +80,20 @@ def check_lit_correlations(baseurl, base_data):
"corr_type": "lit",
"corr_return_results": "200"
}
- top_n_message = "The top 200 correlations ranked by the Literature Correlation"
result = do_request(f"{baseurl}/corr_compute", data)
+
assert result.status_code == 200
- assert (result.text.find(f"Values of record {base_data['trait_id']}") >= 0), result.text
- assert (result.text.find(top_n_message) >= 0), result.text
+ if (data["trait_id"] == "1442370_at"
+ and data["corr_dataset"] in ("BXDPublish",)):
+ top_n_message = (
+ "It is not possible to compute the 'Literature' correlations "
+ f"between trait '{data['trait_id']}' and the data")
+ else:
+ top_n_message = "The top 200 correlations ranked by the Literature Correlation"
+ assert (result.text.find(f"Values of record {base_data['trait_id']}") >= 0), result.text
+
+ assert (html.unescape(result.text).find(top_n_message) >= 0), (
+ f"NOT FOUND: {top_n_message}")
def check_correlations(args_obj, parser):
print("")