aboutsummaryrefslogtreecommitdiff
path: root/test/requests/mapping_tests.py
diff options
context:
space:
mode:
authoracenteno2020-04-21 17:35:34 -0500
committerGitHub2020-04-21 17:35:34 -0500
commit660589b9c2a507529e8e51ca6ce66ca97ad982c5 (patch)
tree27f63957278581bc2fce2b88744bfe20c8a81558 /test/requests/mapping_tests.py
parentd97fdc18359233f07c1a1c7b83fe7e88eb225043 (diff)
parentf2a3ae13231a7d270a5bb6911c248aa713f1ef91 (diff)
downloadgenenetwork2-660589b9c2a507529e8e51ca6ce66ca97ad982c5.tar.gz
Merge pull request #1 from genenetwork/testing
Updating my testing branch
Diffstat (limited to 'test/requests/mapping_tests.py')
-rw-r--r--test/requests/mapping_tests.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/requests/mapping_tests.py b/test/requests/mapping_tests.py
new file mode 100644
index 00000000..6de81bfe
--- /dev/null
+++ b/test/requests/mapping_tests.py
@@ -0,0 +1,42 @@
+from __future__ import print_function
+import re
+import copy
+import json
+import requests
+from lxml.html import fromstring
+
+def load_data_from_file():
+ filename = "../test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json"
+ file_handle = open(filename, "r")
+ file_data = json.loads(file_handle.read().encode("utf-8"))
+ return file_data
+
+def check_R_qtl_tool_selection(host, data):
+ print("")
+ print("R/qtl mapping tool selection")
+ headers = {"Content-Type": "application/x-www-form-urlencoded"}
+ page = requests.post(host+"/marker_regression", data=data, headers=headers)
+ doc = fromstring(page.text)
+ form = doc.forms[1]
+ assert form.fields["dataset"] == "HC_M2_0606_P"
+ assert form.fields["value:BXD1"] == "15.034"
+
+def check_CIM_tool_selection(host, data):
+ print("")
+ print("CIM mapping tool selection (using reaper)")
+ data["method"] = "reaper"
+ page = requests.post(host+"/marker_regression", data=data)
+ doc = fromstring(page.text)
+ form = doc.forms[1]
+ assert form.fields["dataset"] == "HC_M2_0606_P"
+ assert form.fields["value:BXD1"] == "15.034"
+
+def check_mapping(args_obj, parser):
+ print("")
+ print("Checking mapping")
+
+ host = args_obj.host
+ data = load_data_from_file()
+ check_pylmm_tool_selection(host, copy.deepcopy(data))
+ check_R_qtl_tool_selection(host, copy.deepcopy(data)) ## Why does this fail?
+ check_CIM_tool_selection(host, copy.deepcopy(data))