aboutsummaryrefslogtreecommitdiff
path: root/test/requests/link_checker.py
diff options
context:
space:
mode:
authorzsloan2018-04-16 22:23:19 +0000
committerzsloan2018-04-16 22:23:19 +0000
commit35913e15bb6ac93c429e9465ebc36215cc6350ea (patch)
treed0eaff3a15bb167d995f1459ee7e744697f137b3 /test/requests/link_checker.py
parent273b79a0c2096a2eae5ce9aa2800917437459f68 (diff)
parentf511e38a9b440d08313471cdcc7bfd99add98f70 (diff)
downloadgenenetwork2-35913e15bb6ac93c429e9465ebc36215cc6350ea.tar.gz
Resolved conflicts after pulling changes
Diffstat (limited to 'test/requests/link_checker.py')
-rw-r--r--test/requests/link_checker.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/requests/link_checker.py b/test/requests/link_checker.py
index 64553ed8..715f330c 100644
--- a/test/requests/link_checker.py
+++ b/test/requests/link_checker.py
@@ -18,6 +18,10 @@ def is_internal_link(link):
pattern = re.compile("^/.*")
return pattern.match(link)
+def is_in_page_link(link):
+ pattern = re.compile("^#.*")
+ return pattern.match(link)
+
def get_links(doc):
return filter(
lambda x: not (
@@ -40,6 +44,7 @@ def verify_link(link):
else:
print("ERROR: link `"+link+"` failed with status "
, result.status_code)
+
if DO_FAIL:
raise Exception("Failed verify")
except ConnectionError as ex:
@@ -52,9 +57,10 @@ def check_page(host, start_url):
print("Checking links host "+host+" in page `"+start_url+"`")
doc = parse(start_url).getroot()
links = get_links(doc)
+ in_page_links = filter(is_in_page_link, links)
internal_links = filter(is_internal_link, links)
- external_links = filter(lambda x: not is_internal_link(x), links)
- # external_links.append("http://somenon-existentsite.brr")
+ external_links = filter(lambda x: not (is_internal_link(x) or is_in_page_link(x)), links)
+
for link in internal_links:
verify_link(host+link)