about summary refs log tree commit diff
path: root/test/requests/main_web_functionality.py
diff options
context:
space:
mode:
authorzsloan2018-03-29 10:36:12 -0500
committerGitHub2018-03-29 10:36:12 -0500
commitb215b5fe5c6d13f0ed445106230e1e38db71c918 (patch)
tree97f1f47b092bef38856ac34c1bd745e471c38311 /test/requests/main_web_functionality.py
parente67e3a76fca0bad4796853eb58140a412922bc9c (diff)
parente0c706c51c834caa836ecffd27a5d18fc23178ff (diff)
downloadgenenetwork2-b215b5fe5c6d13f0ed445106230e1e38db71c918.tar.gz
Merge pull request #297 from pjotrp/testing
Testing
Diffstat (limited to 'test/requests/main_web_functionality.py')
-rw-r--r--test/requests/main_web_functionality.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/requests/main_web_functionality.py b/test/requests/main_web_functionality.py
new file mode 100644
index 00000000..7b89b833
--- /dev/null
+++ b/test/requests/main_web_functionality.py
@@ -0,0 +1,40 @@
+from __future__ import print_function
+import re
+import requests
+from lxml.html import parse
+from link_checker import check_page
+from requests.exceptions import ConnectionError
+
+def check_home(url):
+    doc = parse(url).getroot()
+    search_button = doc.cssselect("#btsearch")
+    assert(search_button[0].value == "Search")
+    print("OK")
+
+def check_search_page(host):
+    data = dict(
+        species="mouse"
+        , group="BXD"
+        , type="Hippocampus mRNA"
+        , dataset="HC_M2_0606_P"
+        , search_terms_or=""
+        , search_terms_and="MEAN=(15 16) LRS=(23 46)")
+    result = requests.get(host+"/search", params=data)
+    found = result.text.find("/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P")
+    assert(found >= 0)
+    print("OK")
+    check_traits_page(host, "/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P")
+
+def check_traits_page(host, traits_url):
+    doc = parse(host+traits_url).getroot()
+    traits_form = doc.forms[1]
+    assert(traits_form.fields["corr_dataset"] == "HC_M2_0606_P")
+    print("OK")
+    check_page(host, host+traits_url)
+
+def check_main_web_functionality(args_obj, parser):
+    print("")
+    print("Checking main web functionality...")
+    host = args_obj.host
+    check_home(host)
+    check_search_page(host)