aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-08-12 14:34:02 +0300
committerFrederick Muriuki Muriithi2022-08-12 14:34:02 +0300
commit3cfd0ec3d38f4b460817606ea5d6749a1a85a1ea (patch)
treef9c4a1fe1a7ac6f91268d5f5a8889514f70aeac5 /test
parent30ec1cec4c2ddf878131dbc48b36373a93cb8148 (diff)
downloadgenenetwork2-3cfd0ec3d38f4b460817606ea5d6749a1a85a1ea.tar.gz
Update to newer lxml API
Diffstat (limited to 'test')
-rw-r--r--test/requests/link_checker.py5
-rw-r--r--test/requests/main_web_functionality.py10
2 files changed, 9 insertions, 6 deletions
diff --git a/test/requests/link_checker.py b/test/requests/link_checker.py
index feae6526..86222254 100644
--- a/test/requests/link_checker.py
+++ b/test/requests/link_checker.py
@@ -1,6 +1,6 @@
import re
import requests
-from lxml.html import parse
+from lxml.html import document_fromstring
from requests.exceptions import ConnectionError
DO_FAIL=False # fail on error
@@ -66,7 +66,8 @@ def verify_static_file(link):
def check_page(host, start_url):
print("")
print("Checking links host "+host+" in page `"+start_url+"`")
- doc = parse(start_url).getroot()
+ req = requests.get(start_url)
+ doc = document_fromstring(start_url)
links = get_links(doc)
in_page_links = list(filter(is_in_page_link, links))
internal_links = list(filter(is_internal_link, links))
diff --git a/test/requests/main_web_functionality.py b/test/requests/main_web_functionality.py
index 28033ad5..79f37bb4 100644
--- a/test/requests/main_web_functionality.py
+++ b/test/requests/main_web_functionality.py
@@ -1,10 +1,11 @@
import requests
-from lxml.html import parse
+from lxml.html import document_fromstring
from link_checker import check_page
def check_home(url):
- doc = parse(url).getroot()
+ results = requests.get(url)
+ doc = document_fromstring(results.text)
search_button = doc.cssselect("#btsearch")
assert(search_button[0].value == "Search")
print("OK")
@@ -18,7 +19,7 @@ def check_search_page(host):
search_terms_or="",
search_terms_and="MEAN=(15 16) LRS=(23 46)")
result = requests.get(host+"/search", params=data)
- found = result.text.find("records were found")
+ found = result.text.find("records found")
assert(found >= 0)
assert(result.status_code == 200)
print("OK")
@@ -27,7 +28,8 @@ def check_search_page(host):
def check_traits_page(host, traits_url):
- doc = parse(host+traits_url).getroot()
+ results = requests.get(host+traits_url)
+ doc = document_fromstring(results.text)
traits_form = doc.forms[1]
assert(traits_form.fields["corr_dataset"] == "HC_M2_0606_P")
print("OK")