about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2018-03-18 08:56:03 +0300
committerPjotr Prins2018-03-26 09:29:29 +0000
commitc3fab61242796ef4b7544d784fceb39f4545828e (patch)
treee513734ea9f16ace2a6248d86c660764abe7c680 /test
parent6a111c64c50ffe6daa387034ef8fc3ad3e90fc75 (diff)
downloadgenenetwork2-c3fab61242796ef4b7544d784fceb39f4545828e.tar.gz
Initialise mapping tests
* Add mapping tests, and build the first of the tests.
Diffstat (limited to 'test')
-rw-r--r--test/requests/mapping_tests.py43
-rwxr-xr-xtest/requests/test-website.py14
2 files changed, 51 insertions, 6 deletions
diff --git a/test/requests/mapping_tests.py b/test/requests/mapping_tests.py
new file mode 100644
index 00000000..fd20df11
--- /dev/null
+++ b/test/requests/mapping_tests.py
@@ -0,0 +1,43 @@
+from __future__ import print_function
+import re
+import json
+import requests
+from lxml.html import fromstring
+
+def get_data(list_item):
+    try:
+        value = list_item[1]
+    except:
+        value = None
+    #print("list_item:", list_item, "==>", value)
+    return value
+
+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_pylmm_tool_selection(host, data):
+    data["method"] = "pylmm"
+    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" # Check value in the file
+
+def check_R_qtl_tool_selection(host, data):
+    pass
+
+def check_CIM_tool_selection(host, data):
+    pass
+
+def check_mapping(args_obj, parser):
+    print("")
+    print("Checking mapping")
+
+    host = args_obj.host
+    data = load_data_from_file()
+    check_pylmm_tool_selection(host, data)
+    check_R_qtl_tool_selection(host, data)
+    check_CIM_tool_selection(host, data)
diff --git a/test/requests/test-website.py b/test/requests/test-website.py
index f65c3fc8..2bef6eb1 100755
--- a/test/requests/test-website.py
+++ b/test/requests/test-website.py
@@ -4,9 +4,10 @@
 #
 # Mostly to pick up the Guix GN2_PROFILE and python modules
 from __future__ import print_function
-from main_web_functionality import check_main_web_functionality
-from link_checker import check_links
 import argparse
+from link_checker import check_links
+from mapping_tests import check_mapping
+from main_web_functionality import check_main_web_functionality
 
 print("Mechanical Rob firing up...")
 
@@ -15,6 +16,7 @@ def run_all(args_obj, parser):
     print("Running all tests.")
     check_main_web_functionality(args_obj, parser)
     check_links(args_obj, parser)
+    check_mapping(args_obj, parser)
     # TODO: Add other functions as they are created.
 
 def print_help(args_obj, parser):
@@ -51,14 +53,14 @@ parser.add_argument("-f", "--main-functionality", dest="accumulate"
                     , default=print_help
                     , help="Checks for main web functionality.")
 
+parser.add_argument("-m", "--mapping", dest="accumulate"
+                    , action="store_const", const=check_mapping, default=print_help
+                    , help="Checks for mapping.")
+
 # parser.add_argument("-n", "--navigation", dest="accumulate"
 #                     , action="store_const", const=check_navigation, default=print_help
 #                     , help="Checks for navigation.")
 
-# parser.add_argument("-m", "--mapping", dest="accumulate"
-#                     , action="store_const", const=check_mapping, default=print_help
-#                     , help="Checks for mapping.")
-
 # parser.add_argument("-s", "--skip-broken", dest="accumulate"
 #                     , action="store_const", const=dummy, default=print_help
 #                     , help="Skip tests that are known to be broken.")