aboutsummaryrefslogtreecommitdiff
path: root/test/requests/link_checker.py
diff options
context:
space:
mode:
authorPjotr Prins2018-03-30 07:49:01 +0000
committerPjotr Prins2018-03-30 07:49:01 +0000
commit13ba222e4a04c514d10c35caafb5297309914d4c (patch)
treec9d15821761c252899842191858202db38eb9e9e /test/requests/link_checker.py
parente0c706c51c834caa836ecffd27a5d18fc23178ff (diff)
downloadgenenetwork2-13ba222e4a04c514d10c35caafb5297309914d4c.tar.gz
Tests: all tests run
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 256bf6ef..5adbf9a9 100644
--- a/test/requests/link_checker.py
+++ b/test/requests/link_checker.py
@@ -25,10 +25,16 @@ def get_links(doc):
, doc.cssselect("a")))
def verify_link(link):
+ if link[0] == "#":
+ # local link on page
+ return
+ print("verifying "+link)
try:
- result = requests.get(link, timeout=20)
+ result = requests.get(link, timeout=20, verify=False)
if result.status_code == 200:
print(link+" ==> OK")
+ elif result.status_code == 307:
+ print(link+" ==> REDIRECT")
else:
print("ERROR: link `"+link+"` failed with status "
, result.status_code)
@@ -37,7 +43,7 @@ def verify_link(link):
def check_page(host, start_url):
print("")
- print("Checking links in page `"+start_url+"`")
+ print("Checking links host "+host+" in page `"+start_url+"`")
doc = parse(start_url).getroot()
links = get_links(doc)
internal_links = filter(is_internal_link, links)